Also, fixed and improved some parsing sections concerning collection indeces and ranges
53 lines
1.6 KiB
Go
53 lines
1.6 KiB
Go
// Copyright (c) 2024 Celestino Amoroso (celestino.amoroso@gmail.com).
|
|
// All rights reserved.
|
|
|
|
// t_template_test.go
|
|
package expr
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestRelational(t *testing.T) {
|
|
section := "Relational"
|
|
inputs := []inputType{
|
|
/* 1 */ {`1 == 3-2`, true, nil},
|
|
/* 2 */ {`"a" == "a"`, true, nil},
|
|
/* 3 */ {`true == false`, false, nil},
|
|
/* 4 */ {`1.0 == 3.0-2`, true, nil},
|
|
/* 5 */ {`[1,2] == [2,1]`, false, nil},
|
|
/* 6 */ {`1 != 3-2`, false, nil},
|
|
/* 7 */ {`"a" != "a"`, false, nil},
|
|
/* 8 */ {`true != false`, true, nil},
|
|
/* 9 */ {`1.0 != 3.0-2`, false, nil},
|
|
/* 10 */ {`[1,2] != [2,1]`, true, nil},
|
|
/* 11 */ {`1:2 == 1:3`, false, nil},
|
|
/* 12 */ {`1:2 != 1:3`, true, nil},
|
|
/* 13 */ {`1:2 == 4:8`, true, nil},
|
|
/* 14 */ {`1 < 8`, true, nil},
|
|
/* 15 */ {`1 <= 8`, true, nil},
|
|
/* 16 */ {`"a" < "b"`, true, nil},
|
|
/* 17 */ {`"a" <= "b"`, true, nil},
|
|
/* 18 */ {`1.0 < 8`, true, nil},
|
|
/* 19 */ {`1.0 <= 8`, true, nil},
|
|
/* 20 */ {`1.0 <= 1.0`, true, nil},
|
|
/* 21 */ {`1.0 == 1`, true, nil},
|
|
/* 22 */ {`1:2 < 1:3`, false, nil},
|
|
/* 23 */ {`1:2 <= 1:3`, false, nil},
|
|
/* 24 */ {`1:2 > 1:3`, true, nil},
|
|
/* 25 */ {`1:2 >= 1:3`, true, nil},
|
|
/* 26 */ {`[1,2,3] > [2]`, true, nil},
|
|
/* 27 */ {`[1,2,3] > [9]`, false, nil},
|
|
/* 28 */ {`[1,2,3] >= [6]`, false, nil},
|
|
/* 29 */ {`[1,2,3] >= [2,6]`, false, nil},
|
|
/* 30 */ {`[1,[2,3],4] > [[3,2]]`, true, nil},
|
|
/* 31 */ {`[1,[2,[3,4]],5] > [[[4,3],2]]`, true, nil},
|
|
/* 32 */ {`[[4,3],2] IN [1,[2,[3,4]],5]`, true, nil},
|
|
}
|
|
|
|
// t.Setenv("EXPR_PATH", ".")
|
|
|
|
// parserTestSpec(t, section, inputs, 31)
|
|
runTestSuite(t, section, inputs)
|
|
}
|