diff --git a/test.py b/test.py index 430062d..e4237d1 100755 --- a/test.py +++ b/test.py @@ -114,6 +114,273 @@ [64, 'eval a=42', '', "err: at '=': invalid assignment target"], [65, 'var a; var a', '', "err: at 'a': variable with this name already present"], [66, 'eval a', '', "err: at 'a': undefined variable"], + + [67.1, 'print -1', "-1"], + [67.2, 'print -1.2', "-1.2"], + [67.3, 'print -(1)', "-1"], + [67.4, 'print -(1.2)', "-1.2"], + [67.5, 'var a=1; print -a', "-1"], + [67.6, 'var a=1.2; print -a', "-1.2"], + [67.7, 'print -true', '', "err: NEG: invalid type: bool, expected number"], + [67.8, 'print -"abc"', '', "err: NEG: invalid type: string, expected number"], + [67.9, 'print -nil', '', "err: NEG: invalid type: nil, expected number"], + + [68.1, 'print +1', "1"], + [68.2, 'print +1.2', "1.2"], + [68.3, 'print +(1)', "1"], + [68.4, 'print +(1.2)', "1.2"], + [67.5, 'var a=1; print +a', "1"], + [67.6, 'var a=1.2; print +a', "1.2"], + [68.7, 'print +true', '', "err: UNPLUS: invalid type: bool, expected number"], + [68.8, 'print +"abcd"', '', "err: UNPLUS: invalid type: string, expected number"], + [68.9, 'print +nil', '', "err: UNPLUS: invalid type: nil, expected number"], + + [69, 'print *1', '', "err: at '*': expected expression"], + [70, 'print /1', '', "err: at '/': expected expression"], + + [71.1, 'print 1+2', '3'], + [71.2, 'print 1+2.5', '3.5'], + [71.3, 'print 1+true', '', "err: ADD: invalid types: int, bool"], + [71.4, 'print 1+"ab"', '', "err: ADD: invalid types: int, string"], + [71.5, 'print 1+nil', '', "err: ADD: invalid types: int, nil"], + [72.1, 'print 1.2+5', '6.2'], + [72.2, 'print 1.2+3.5', '4.7'], + [72.3, 'print 1.2+true', '', "err: ADD: invalid types: float, bool"], + [72.4, 'print 1.2+"ab"', '', "err: ADD: invalid types: float, string"], + [72.5, 'print 1.2+nil', '', "err: ADD: invalid types: float, nil"], + [73.1, 'print true+1', '', "err: ADD: invalid types: bool, int"], + [73.2, 'print true+1.2', '', "err: ADD: invalid types: bool, float"], + [73.3, 'print true+true', '', "err: ADD: invalid types: bool, bool"], + [73.4, 'print true+"ab"', '', "err: ADD: invalid types: bool, string"], + [73.5, 'print true+nil', '', "err: ADD: invalid types: bool, nil"], + [74.1, 'print "ab"+1', 'ab1'], + [74.2, 'print "ab"+1.2', 'ab1.2'], + [74.3, 'print "ab"+true', '', "err: ADD: invalid types: string, bool"], + [74.4, 'print "ab"+"cd"', 'abcd'], + [74.5, 'print "ab"+nil', 'ab'], + [75.1, 'print nil+1', '', "err: ADD: invalid types: nil, int"], + [75.2, 'print nil+1.2', '', "err: ADD: invalid types: nil, float"], + [75.3, 'print nil+true', '', "err: ADD: invalid types: nil, bool"], + [75.4, 'print nil+"ab"', '', "err: ADD: invalid types: nil, string"], + [75.5, 'print nil+nil', '', "err: ADD: invalid types: nil, nil"], + + [76.1, 'print 1-2', '-1'], + [76.2, 'print 1-2.5', '-1.5'], + [76.3, 'print 1-true', '', "err: SUB: invalid types: int, bool"], + [76.4, 'print 1-"ab"', '', "err: SUB: invalid types: int, string"], + [76.5, 'print 1-nil', '', "err: SUB: invalid types: int, nil"], + [77.1, 'print 1.5-2', '-0.5'], + [77.2, 'print 1.0-2.5', '-1.5'], + [77.3, 'print 1.2-true', '', "err: SUB: invalid types: float, bool"], + [77.4, 'print 1.2-"ab"', '', "err: SUB: invalid types: float, string"], + [77.5, 'print 1.2-nil', '', "err: SUB: invalid types: float, nil"], + [78.1, 'print true-1', '', "err: SUB: invalid types: bool, int"], + [78.2, 'print true-1.2', '', "err: SUB: invalid types: bool, float"], + [78.3, 'print true-true', '', "err: SUB: invalid types: bool, bool"], + [78.4, 'print true-"ab"', '', "err: SUB: invalid types: bool, string"], + [78.5, 'print true-nil', '', "err: SUB: invalid types: bool, nil"], + [79.1, 'print "ab"-1', '', "err: SUB: invalid types: string, int"], + [79.2, 'print "ab"-1.2', '', "err: SUB: invalid types: string, float"], + [79.3, 'print "ab"-true', '', "err: SUB: invalid types: string, bool"], + [79.4, 'print "ab"-"cd"', '', "err: SUB: invalid types: string, string"], + [79.5, 'print "ab"-nil', '', "err: SUB: invalid types: string, nil"], + [80.1, 'print nil-1', '', "err: SUB: invalid types: nil, int"], + [80.2, 'print nil-1.2', '', "err: SUB: invalid types: nil, float"], + [80.3, 'print nil-true', '', "err: SUB: invalid types: nil, bool"], + [80.4, 'print nil-"ab"', '', "err: SUB: invalid types: nil, string"], + [80.5, 'print nil-nil', '', "err: SUB: invalid types: nil, nil"], + + [81.1, 'print 1*2', '2'], + [81.2, 'print 1*2.5', '2.5'], + [81.3, 'print 1*true', '', "err: MUL: invalid types: int, bool"], + [81.4, 'print 1*"ab"', '', "err: MUL: invalid types: int, string"], + [81.5, 'print 1*nil', '', "err: MUL: invalid types: int, nil"], + [82.1, 'print 1.4*2', '2.8'], + [82.2, 'print 1.0*2.5', '2.5'], + [82.3, 'print 1.2*true', '', "err: MUL: invalid types: float, bool"], + [82.4, 'print 1.2*"ab"', '', "err: MUL: invalid types: float, string"], + [82.5, 'print 1.2*nil', '', "err: MUL: invalid types: float, nil"], + [83.1, 'print true*1', '', "err: MUL: invalid types: bool, int"], + [83.2, 'print true*1.2', '', "err: MUL: invalid types: bool, float"], + [83.3, 'print true*true', '', "err: MUL: invalid types: bool, bool"], + [83.4, 'print true*"ab"', '', "err: MUL: invalid types: bool, string"], + [83.5, 'print true*nil', '', "err: MUL: invalid types: bool, nil"], + [84.1, 'print "ab"*2', 'abab'], + [84.2, 'print "ab"*1.2', '', "err: MUL: invalid types: string, float"], + [84.3, 'print "ab"*true', '', "err: MUL: invalid types: string, bool"], + [84.4, 'print "ab"*"cd"', '', "err: MUL: invalid types: string, string"], + [84.5, 'print "ab"*nil', '', "err: MUL: invalid types: string, nil"], + [85.1, 'print nil*1', '', "err: MUL: invalid types: nil, int"], + [85.2, 'print nil*1.2', '', "err: MUL: invalid types: nil, float"], + [85.3, 'print nil*true', '', "err: MUL: invalid types: nil, bool"], + [85.4, 'print nil*"ab"', '', "err: MUL: invalid types: nil, string"], + [85.5, 'print nil*nil', '', "err: MUL: invalid types: nil, nil"], + + [86.1, 'print 1/2', '0'], + [86.2, 'print 1/2.0', '0.5'], + [86.3, 'print 1/true', '', "err: DIV: invalid types: int, bool"], + [86.4, 'print 1/"ab"', '', "err: DIV: invalid types: int, string"], + [86.5, 'print 1/nil', '', "err: DIV: invalid types: int, nil"], + [87.1, 'print 1.0/2', '0.5'], + [87.2, 'print 1.0/2.0', '0.5'], + [87.3, 'print 1.2/true', '', "err: DIV: invalid types: float, bool"], + [87.4, 'print 1.2/"ab"', '', "err: DIV: invalid types: float, string"], + [87.5, 'print 1.2/nil', '', "err: DIV: invalid types: float, nil"], + [88.1, 'print true/1', '', "err: DIV: invalid types: bool, int"], + [88.2, 'print true/1.2', '', "err: DIV: invalid types: bool, float"], + [88.3, 'print true/true', '', "err: DIV: invalid types: bool, bool"], + [88.4, 'print true/"ab"', '', "err: DIV: invalid types: bool, string"], + [88.5, 'print true/nil', '', "err: DIV: invalid types: bool, nil"], + [89.1, 'print "ab"/2', '', "err: DIV: invalid types: string, int"], + [89.2, 'print "ab"/1.2', '', "err: DIV: invalid types: string, float"], + [89.3, 'print "ab"/true', '', "err: DIV: invalid types: string, bool"], + [89.4, 'print "ab"/"cd"', '', "err: DIV: invalid types: string, string"], + [89.5, 'print "ab"/nil', '', "err: DIV: invalid types: string, nil"], + [90.1, 'print nil/1', '', "err: DIV: invalid types: nil, int"], + [90.2, 'print nil/1.2', '', "err: DIV: invalid types: nil, float"], + [90.3, 'print nil/true', '', "err: DIV: invalid types: nil, bool"], + [90.4, 'print nil/"ab"', '', "err: DIV: invalid types: nil, string"], + [90.5, 'print nil/nil', '', "err: DIV: invalid types: nil, nil"], + + [91.1, 'print 1==1', 'true'], + [91.2, 'print 1==1.0', 'true'], + [91.3, 'print 1==true', 'false'], + [91.4, 'print 1=="ab"', 'false'], + [91.5, 'print 1==nil', 'false'], + [92.1, 'print 1.0==1', 'true'], + [92.2, 'print 1.0==1.0', 'true'], + [92.3, 'print 1.2==true', 'false'], + [92.4, 'print 1.2=="ab"', 'false'], + [92.5, 'print 1.2==nil', 'false'], + [93.1, 'print true==1', 'false'], + [93.2, 'print true==1.2', 'false'], + [93.3, 'print true==true', 'true'], + [93.4, 'print true=="ab"', 'false'], + [93.5, 'print true==nil', 'false'], + [94.1, 'print "ab"==2', 'false'], + [94.2, 'print "ab"==1.2', 'false'], + [94.3, 'print "ab"==true', 'false'], + [94.4, 'print "ab"=="cd"', 'false'], + [94.5, 'print "ab"==nil', 'false'], + [95.1, 'print nil==1', 'false'], + [95.2, 'print nil==1.2', 'false'], + [95.3, 'print nil==true', 'false'], + [95.4, 'print nil=="ab"', 'false'], + [95.5, 'print nil==nil', 'true'], + + [96.1, 'print 1<2', 'true'], + [96.2, 'print 1<2.0', 'true'], + [96.3, 'print 12', 'false'], + [101.2, 'print 1>2.0', 'false'], + [101.3, 'print 1>true', '', "err: GT: invalid types: int, bool"], + [101.4, 'print 1>"ab"', '', "err: GT: invalid types: int, string"], + [101.5, 'print 1>nil', '', "err: GT: invalid types: int, nil"], + [102.1, 'print 1.0>2', 'false'], + [102.2, 'print 1.0>2.0', 'false'], + [102.3, 'print 1.2>true', '', "err: GT: invalid types: float, bool"], + [102.4, 'print 1.2>"ab"', '', "err: GT: invalid types: float, string"], + [102.5, 'print 1.2>nil', '', "err: GT: invalid types: float, nil"], + [103.1, 'print true>1', '', "err: GT: invalid types: bool, int"], + [103.2, 'print true>1.0', '', "err: GT: invalid types: bool, float"], + [103.3, 'print true>true', '', "err: GT: invalid types: bool, bool"], + [103.4, 'print true>"ab"', '', "err: GT: invalid types: bool, string"], + [103.5, 'print true>nil', '', "err: GT: invalid types: bool, nil"], + [104.1, 'print "ab">2', '', "err: GT: invalid types: string, int"], + [104.2, 'print "ab">1.2', '', "err: GT: invalid types: string, float"], + [104.3, 'print "ab">true', '', "err: GT: invalid types: string, bool"], + [104.4, 'print "ab">"cd"', 'false'], + [104.5, 'print "ab">nil', '', "err: GT: invalid types: string, nil"], + [105.1, 'print nil>1', '', "err: GT: invalid types: nil, int"], + [105.2, 'print nil>1.2', '', "err: GT: invalid types: nil, float"], + [105.3, 'print nil>true', '', "err: GT: invalid types: nil, bool"], + [105.4, 'print nil>"ab"', '', "err: GT: invalid types: nil, string "], + [105.5, 'print nil>nil', '', "err: GT: invalid types: nil, nil"], + + [106.1, 'print not 0', 'false'], + [106.2, 'print not 0.0', 'false'], + [106.3, 'print not false', 'true'], + [106.4, 'print not ""', 'true'], + [106.5, 'print not nil', 'true'], + + [107.1, 'print 1 or 2', '1'], + [107.2, 'print 1 or 2.0', '1'], + [107.3, 'print 1 or true', '1'], + [107.4, 'print 1 or "ab"', '1'], + [107.5, 'print 1 or nil', '1'], + [108.1, 'print 1.2 or 2', '1.2'], + [108.2, 'print 1.2 or 2.0', '1.2'], + [108.3, 'print 1.2 or true', '1.2'], + [108.4, 'print 1.2 or "ab"', '1.2'], + [108.5, 'print 1.2 or nil', '1.2' ], + [109.1, 'print true or 1', 'true'], + [109.2, 'print true or 1.0', 'true'], + [109.3, 'print true or true', 'true'], + [109.4, 'print true or "ab"', 'true'], + [109.5, 'print true or nil', 'true'], + [110.1, 'print "ab" or 2', 'ab'], + [110.2, 'print "ab" or 1.2', 'ab'], + [110.3, 'print "ab" or true', 'ab'], + [110.4, 'print "ab" or "cd"', 'ab'], + [110.5, 'print "ab" or nil', 'ab'], + [112.1, 'print nil or 1', '1'], + [112.2, 'print nil or 1.2', '1.2'], + [112.3, 'print nil or true', 'true'], + [112.4, 'print nil or "ab"', 'ab'], + [112.5, 'print nil or nil', ''], + + [113.1, 'print 1 and 2', '2'], + [113.2, 'print 1 and 2.5', '2.5'], + [113.3, 'print 1 and true', 'true'], + [113.4, 'print 1 and "ab"', 'ab'], + [113.5, 'print 1 and nil', ''], + [114.1, 'print 1.2 and 2', '2'], + [114.2, 'print 1.2 and 2.5', '2.5'], + [114.3, 'print 1.2 and true', 'true'], + [114.4, 'print 1.2 and "ab"', 'ab'], + [114.5, 'print 1.2 and nil', ''], + [115.1, 'print true and 2', '2'], + [115.2, 'print true and 2.5', '2.5'], + [115.3, 'print true and true', 'true'], + [115.4, 'print true and "ab"', 'ab'], + [115.5, 'print true and nil', ''], + [116.1, 'print "ab" and 2', '2'], + [116.2, 'print "ab" and 2.5', '2.5'], + [116.3, 'print "ab" and true', 'true'], + [116.4, 'print "ab" and "cd"', 'cd'], + [116.5, 'print "ab" and nil', ''], + [117.1, 'print nil and 2', ''], + [117.2, 'print nil and 2.5', ''], + [117.3, 'print nil and true', ''], + [117.4, 'print nil and "ab"', ''], + [117.5, 'print nil and nil', ''], + + [120, 'def b{x}', '', "err: 'x' not resolved as var or field"], + [121.1, 'print 1/0', '', "err: division by int zero"], + [121.2, 'print 1/0.0', '+Inf'], ] diff --git a/testapi_test.go b/testapi_test.go index 80a2193..58acdac 100644 --- a/testapi_test.go +++ b/testapi_test.go @@ -115,6 +115,259 @@ func TestInterpretFromPy(t *testing.T) { {`64`, `eval a=42`, "", false, true, "at '=': invalid assignment target"}, {`65`, `var a; var a`, "", false, true, "at 'a': variable with this name already present"}, {`66`, `eval a`, "", false, true, "at 'a': undefined variable"}, + {`67.1`, `print -1`, "-1", false, false, ""}, + {`67.2`, `print -1.2`, "-1.2", false, false, ""}, + {`67.3`, `print -(1)`, "-1", false, false, ""}, + {`67.4`, `print -(1.2)`, "-1.2", false, false, ""}, + {`67.5`, `var a=1; print -a`, "-1", false, false, ""}, + {`67.6`, `var a=1.2; print -a`, "-1.2", false, false, ""}, + {`67.7`, `print -true`, "", false, true, "NEG: invalid type: bool, expected number"}, + {`67.8`, `print -"abc"`, "", false, true, "NEG: invalid type: string, expected number"}, + {`67.9`, `print -nil`, "", false, true, "NEG: invalid type: nil, expected number"}, + {`68.1`, `print +1`, "1", false, false, ""}, + {`68.2`, `print +1.2`, "1.2", false, false, ""}, + {`68.3`, `print +(1)`, "1", false, false, ""}, + {`68.4`, `print +(1.2)`, "1.2", false, false, ""}, + {`67.5`, `var a=1; print +a`, "1", false, false, ""}, + {`67.6`, `var a=1.2; print +a`, "1.2", false, false, ""}, + {`68.7`, `print +true`, "", false, true, "UNPLUS: invalid type: bool, expected number"}, + {`68.8`, `print +"abcd"`, "", false, true, "UNPLUS: invalid type: string, expected number"}, + {`68.9`, `print +nil`, "", false, true, "UNPLUS: invalid type: nil, expected number"}, + {`69`, `print *1`, "", false, true, "at '*': expected expression"}, + {`70`, `print /1`, "", false, true, "at '/': expected expression"}, + {`71.1`, `print 1+2`, "3", false, false, ""}, + {`71.2`, `print 1+2.5`, "3.5", false, false, ""}, + {`71.3`, `print 1+true`, "", false, true, "ADD: invalid types: int, bool"}, + {`71.4`, `print 1+"ab"`, "", false, true, "ADD: invalid types: int, string"}, + {`71.5`, `print 1+nil`, "", false, true, "ADD: invalid types: int, nil"}, + {`72.1`, `print 1.2+5`, "6.2", false, false, ""}, + {`72.2`, `print 1.2+3.5`, "4.7", false, false, ""}, + {`72.3`, `print 1.2+true`, "", false, true, "ADD: invalid types: float, bool"}, + {`72.4`, `print 1.2+"ab"`, "", false, true, "ADD: invalid types: float, string"}, + {`72.5`, `print 1.2+nil`, "", false, true, "ADD: invalid types: float, nil"}, + {`73.1`, `print true+1`, "", false, true, "ADD: invalid types: bool, int"}, + {`73.2`, `print true+1.2`, "", false, true, "ADD: invalid types: bool, float"}, + {`73.3`, `print true+true`, "", false, true, "ADD: invalid types: bool, bool"}, + {`73.4`, `print true+"ab"`, "", false, true, "ADD: invalid types: bool, string"}, + {`73.5`, `print true+nil`, "", false, true, "ADD: invalid types: bool, nil"}, + {`74.1`, `print "ab"+1`, "ab1", false, false, ""}, + {`74.2`, `print "ab"+1.2`, "ab1.2", false, false, ""}, + {`74.3`, `print "ab"+true`, "", false, true, "ADD: invalid types: string, bool"}, + {`74.4`, `print "ab"+"cd"`, "abcd", false, false, ""}, + {`74.5`, `print "ab"+nil`, "ab", false, false, ""}, + {`75.1`, `print nil+1`, "", false, true, "ADD: invalid types: nil, int"}, + {`75.2`, `print nil+1.2`, "", false, true, "ADD: invalid types: nil, float"}, + {`75.3`, `print nil+true`, "", false, true, "ADD: invalid types: nil, bool"}, + {`75.4`, `print nil+"ab"`, "", false, true, "ADD: invalid types: nil, string"}, + {`75.5`, `print nil+nil`, "", false, true, "ADD: invalid types: nil, nil"}, + {`76.1`, `print 1-2`, "-1", false, false, ""}, + {`76.2`, `print 1-2.5`, "-1.5", false, false, ""}, + {`76.3`, `print 1-true`, "", false, true, "SUB: invalid types: int, bool"}, + {`76.4`, `print 1-"ab"`, "", false, true, "SUB: invalid types: int, string"}, + {`76.5`, `print 1-nil`, "", false, true, "SUB: invalid types: int, nil"}, + {`77.1`, `print 1.5-2`, "-0.5", false, false, ""}, + {`77.2`, `print 1.0-2.5`, "-1.5", false, false, ""}, + {`77.3`, `print 1.2-true`, "", false, true, "SUB: invalid types: float, bool"}, + {`77.4`, `print 1.2-"ab"`, "", false, true, "SUB: invalid types: float, string"}, + {`77.5`, `print 1.2-nil`, "", false, true, "SUB: invalid types: float, nil"}, + {`78.1`, `print true-1`, "", false, true, "SUB: invalid types: bool, int"}, + {`78.2`, `print true-1.2`, "", false, true, "SUB: invalid types: bool, float"}, + {`78.3`, `print true-true`, "", false, true, "SUB: invalid types: bool, bool"}, + {`78.4`, `print true-"ab"`, "", false, true, "SUB: invalid types: bool, string"}, + {`78.5`, `print true-nil`, "", false, true, "SUB: invalid types: bool, nil"}, + {`79.1`, `print "ab"-1`, "", false, true, "SUB: invalid types: string, int"}, + {`79.2`, `print "ab"-1.2`, "", false, true, "SUB: invalid types: string, float"}, + {`79.3`, `print "ab"-true`, "", false, true, "SUB: invalid types: string, bool"}, + {`79.4`, `print "ab"-"cd"`, "", false, true, "SUB: invalid types: string, string"}, + {`79.5`, `print "ab"-nil`, "", false, true, "SUB: invalid types: string, nil"}, + {`80.1`, `print nil-1`, "", false, true, "SUB: invalid types: nil, int"}, + {`80.2`, `print nil-1.2`, "", false, true, "SUB: invalid types: nil, float"}, + {`80.3`, `print nil-true`, "", false, true, "SUB: invalid types: nil, bool"}, + {`80.4`, `print nil-"ab"`, "", false, true, "SUB: invalid types: nil, string"}, + {`80.5`, `print nil-nil`, "", false, true, "SUB: invalid types: nil, nil"}, + {`81.1`, `print 1*2`, "2", false, false, ""}, + {`81.2`, `print 1*2.5`, "2.5", false, false, ""}, + {`81.3`, `print 1*true`, "", false, true, "MUL: invalid types: int, bool"}, + {`81.4`, `print 1*"ab"`, "", false, true, "MUL: invalid types: int, string"}, + {`81.5`, `print 1*nil`, "", false, true, "MUL: invalid types: int, nil"}, + {`82.1`, `print 1.4*2`, "2.8", false, false, ""}, + {`82.2`, `print 1.0*2.5`, "2.5", false, false, ""}, + {`82.3`, `print 1.2*true`, "", false, true, "MUL: invalid types: float, bool"}, + {`82.4`, `print 1.2*"ab"`, "", false, true, "MUL: invalid types: float, string"}, + {`82.5`, `print 1.2*nil`, "", false, true, "MUL: invalid types: float, nil"}, + {`83.1`, `print true*1`, "", false, true, "MUL: invalid types: bool, int"}, + {`83.2`, `print true*1.2`, "", false, true, "MUL: invalid types: bool, float"}, + {`83.3`, `print true*true`, "", false, true, "MUL: invalid types: bool, bool"}, + {`83.4`, `print true*"ab"`, "", false, true, "MUL: invalid types: bool, string"}, + {`83.5`, `print true*nil`, "", false, true, "MUL: invalid types: bool, nil"}, + {`84.1`, `print "ab"*2`, "abab", false, false, ""}, + {`84.2`, `print "ab"*1.2`, "", false, true, "MUL: invalid types: string, float"}, + {`84.3`, `print "ab"*true`, "", false, true, "MUL: invalid types: string, bool"}, + {`84.4`, `print "ab"*"cd"`, "", false, true, "MUL: invalid types: string, string"}, + {`84.5`, `print "ab"*nil`, "", false, true, "MUL: invalid types: string, nil"}, + {`85.1`, `print nil*1`, "", false, true, "MUL: invalid types: nil, int"}, + {`85.2`, `print nil*1.2`, "", false, true, "MUL: invalid types: nil, float"}, + {`85.3`, `print nil*true`, "", false, true, "MUL: invalid types: nil, bool"}, + {`85.4`, `print nil*"ab"`, "", false, true, "MUL: invalid types: nil, string"}, + {`85.5`, `print nil*nil`, "", false, true, "MUL: invalid types: nil, nil"}, + {`86.1`, `print 1/2`, "0", false, false, ""}, + {`86.2`, `print 1/2.0`, "0.5", false, false, ""}, + {`86.3`, `print 1/true`, "", false, true, "DIV: invalid types: int, bool"}, + {`86.4`, `print 1/"ab"`, "", false, true, "DIV: invalid types: int, string"}, + {`86.5`, `print 1/nil`, "", false, true, "DIV: invalid types: int, nil"}, + {`87.1`, `print 1.0/2`, "0.5", false, false, ""}, + {`87.2`, `print 1.0/2.0`, "0.5", false, false, ""}, + {`87.3`, `print 1.2/true`, "", false, true, "DIV: invalid types: float, bool"}, + {`87.4`, `print 1.2/"ab"`, "", false, true, "DIV: invalid types: float, string"}, + {`87.5`, `print 1.2/nil`, "", false, true, "DIV: invalid types: float, nil"}, + {`88.1`, `print true/1`, "", false, true, "DIV: invalid types: bool, int"}, + {`88.2`, `print true/1.2`, "", false, true, "DIV: invalid types: bool, float"}, + {`88.3`, `print true/true`, "", false, true, "DIV: invalid types: bool, bool"}, + {`88.4`, `print true/"ab"`, "", false, true, "DIV: invalid types: bool, string"}, + {`88.5`, `print true/nil`, "", false, true, "DIV: invalid types: bool, nil"}, + {`89.1`, `print "ab"/2`, "", false, true, "DIV: invalid types: string, int"}, + {`89.2`, `print "ab"/1.2`, "", false, true, "DIV: invalid types: string, float"}, + {`89.3`, `print "ab"/true`, "", false, true, "DIV: invalid types: string, bool"}, + {`89.4`, `print "ab"/"cd"`, "", false, true, "DIV: invalid types: string, string"}, + {`89.5`, `print "ab"/nil`, "", false, true, "DIV: invalid types: string, nil"}, + {`90.1`, `print nil/1`, "", false, true, "DIV: invalid types: nil, int"}, + {`90.2`, `print nil/1.2`, "", false, true, "DIV: invalid types: nil, float"}, + {`90.3`, `print nil/true`, "", false, true, "DIV: invalid types: nil, bool"}, + {`90.4`, `print nil/"ab"`, "", false, true, "DIV: invalid types: nil, string"}, + {`90.5`, `print nil/nil`, "", false, true, "DIV: invalid types: nil, nil"}, + {`91.1`, `print 1==1`, "true", false, false, ""}, + {`91.2`, `print 1==1.0`, "true", false, false, ""}, + {`91.3`, `print 1==true`, "false", false, false, ""}, + {`91.4`, `print 1=="ab"`, "false", false, false, ""}, + {`91.5`, `print 1==nil`, "false", false, false, ""}, + {`92.1`, `print 1.0==1`, "true", false, false, ""}, + {`92.2`, `print 1.0==1.0`, "true", false, false, ""}, + {`92.3`, `print 1.2==true`, "false", false, false, ""}, + {`92.4`, `print 1.2=="ab"`, "false", false, false, ""}, + {`92.5`, `print 1.2==nil`, "false", false, false, ""}, + {`93.1`, `print true==1`, "false", false, false, ""}, + {`93.2`, `print true==1.2`, "false", false, false, ""}, + {`93.3`, `print true==true`, "true", false, false, ""}, + {`93.4`, `print true=="ab"`, "false", false, false, ""}, + {`93.5`, `print true==nil`, "false", false, false, ""}, + {`94.1`, `print "ab"==2`, "false", false, false, ""}, + {`94.2`, `print "ab"==1.2`, "false", false, false, ""}, + {`94.3`, `print "ab"==true`, "false", false, false, ""}, + {`94.4`, `print "ab"=="cd"`, "false", false, false, ""}, + {`94.5`, `print "ab"==nil`, "false", false, false, ""}, + {`95.1`, `print nil==1`, "false", false, false, ""}, + {`95.2`, `print nil==1.2`, "false", false, false, ""}, + {`95.3`, `print nil==true`, "false", false, false, ""}, + {`95.4`, `print nil=="ab"`, "false", false, false, ""}, + {`95.5`, `print nil==nil`, "true", false, false, ""}, + {`96.1`, `print 1<2`, "true", false, false, ""}, + {`96.2`, `print 1<2.0`, "true", false, false, ""}, + {`96.3`, `print 12`, "false", false, false, ""}, + {`101.2`, `print 1>2.0`, "false", false, false, ""}, + {`101.3`, `print 1>true`, "", false, true, "GT: invalid types: int, bool"}, + {`101.4`, `print 1>"ab"`, "", false, true, "GT: invalid types: int, string"}, + {`101.5`, `print 1>nil`, "", false, true, "GT: invalid types: int, nil"}, + {`102.1`, `print 1.0>2`, "false", false, false, ""}, + {`102.2`, `print 1.0>2.0`, "false", false, false, ""}, + {`102.3`, `print 1.2>true`, "", false, true, "GT: invalid types: float, bool"}, + {`102.4`, `print 1.2>"ab"`, "", false, true, "GT: invalid types: float, string"}, + {`102.5`, `print 1.2>nil`, "", false, true, "GT: invalid types: float, nil"}, + {`103.1`, `print true>1`, "", false, true, "GT: invalid types: bool, int"}, + {`103.2`, `print true>1.0`, "", false, true, "GT: invalid types: bool, float"}, + {`103.3`, `print true>true`, "", false, true, "GT: invalid types: bool, bool"}, + {`103.4`, `print true>"ab"`, "", false, true, "GT: invalid types: bool, string"}, + {`103.5`, `print true>nil`, "", false, true, "GT: invalid types: bool, nil"}, + {`104.1`, `print "ab">2`, "", false, true, "GT: invalid types: string, int"}, + {`104.2`, `print "ab">1.2`, "", false, true, "GT: invalid types: string, float"}, + {`104.3`, `print "ab">true`, "", false, true, "GT: invalid types: string, bool"}, + {`104.4`, `print "ab">"cd"`, "false", false, false, ""}, + {`104.5`, `print "ab">nil`, "", false, true, "GT: invalid types: string, nil"}, + {`105.1`, `print nil>1`, "", false, true, "GT: invalid types: nil, int"}, + {`105.2`, `print nil>1.2`, "", false, true, "GT: invalid types: nil, float"}, + {`105.3`, `print nil>true`, "", false, true, "GT: invalid types: nil, bool"}, + {`105.4`, `print nil>"ab"`, "", false, true, "GT: invalid types: nil, string"}, + {`105.5`, `print nil>nil`, "", false, true, "GT: invalid types: nil, nil"}, + {`106.1`, `print not 0`, "false", false, false, ""}, + {`106.2`, `print not 0.0`, "false", false, false, ""}, + {`106.3`, `print not false`, "true", false, false, ""}, + {`106.4`, `print not ""`, "true", false, false, ""}, + {`106.5`, `print not nil`, "true", false, false, ""}, + {`107.1`, `print 1 or 2`, "1", false, false, ""}, + {`107.2`, `print 1 or 2.0`, "1", false, false, ""}, + {`107.3`, `print 1 or true`, "1", false, false, ""}, + {`107.4`, `print 1 or "ab"`, "1", false, false, ""}, + {`107.5`, `print 1 or nil`, "1", false, false, ""}, + {`108.1`, `print 1.2 or 2`, "1.2", false, false, ""}, + {`108.2`, `print 1.2 or 2.0`, "1.2", false, false, ""}, + {`108.3`, `print 1.2 or true`, "1.2", false, false, ""}, + {`108.4`, `print 1.2 or "ab"`, "1.2", false, false, ""}, + {`108.5`, `print 1.2 or nil`, "1.2", false, false, ""}, + {`109.1`, `print true or 1`, "true", false, false, ""}, + {`109.2`, `print true or 1.0`, "true", false, false, ""}, + {`109.3`, `print true or true`, "true", false, false, ""}, + {`109.4`, `print true or "ab"`, "true", false, false, ""}, + {`109.5`, `print true or nil`, "true", false, false, ""}, + {`110.1`, `print "ab" or 2`, "ab", false, false, ""}, + {`110.2`, `print "ab" or 1.2`, "ab", false, false, ""}, + {`110.3`, `print "ab" or true`, "ab", false, false, ""}, + {`110.4`, `print "ab" or "cd"`, "ab", false, false, ""}, + {`110.5`, `print "ab" or nil`, "ab", false, false, ""}, + {`112.1`, `print nil or 1`, "1", false, false, ""}, + {`112.2`, `print nil or 1.2`, "1.2", false, false, ""}, + {`112.3`, `print nil or true`, "true", false, false, ""}, + {`112.4`, `print nil or "ab"`, "ab", false, false, ""}, + {`112.5`, `print nil or nil`, "", false, false, ""}, + {`113.1`, `print 1 and 2`, "2", false, false, ""}, + {`113.2`, `print 1 and 2.5`, "2.5", false, false, ""}, + {`113.3`, `print 1 and true`, "true", false, false, ""}, + {`113.4`, `print 1 and "ab"`, "ab", false, false, ""}, + {`113.5`, `print 1 and nil`, "", false, false, ""}, + {`114.1`, `print 1.2 and 2`, "2", false, false, ""}, + {`114.2`, `print 1.2 and 2.5`, "2.5", false, false, ""}, + {`114.3`, `print 1.2 and true`, "true", false, false, ""}, + {`114.4`, `print 1.2 and "ab"`, "ab", false, false, ""}, + {`114.5`, `print 1.2 and nil`, "", false, false, ""}, + {`115.1`, `print true and 2`, "2", false, false, ""}, + {`115.2`, `print true and 2.5`, "2.5", false, false, ""}, + {`115.3`, `print true and true`, "true", false, false, ""}, + {`115.4`, `print true and "ab"`, "ab", false, false, ""}, + {`115.5`, `print true and nil`, "", false, false, ""}, + {`116.1`, `print "ab" and 2`, "2", false, false, ""}, + {`116.2`, `print "ab" and 2.5`, "2.5", false, false, ""}, + {`116.3`, `print "ab" and true`, "true", false, false, ""}, + {`116.4`, `print "ab" and "cd"`, "cd", false, false, ""}, + {`116.5`, `print "ab" and nil`, "", false, false, ""}, + {`117.1`, `print nil and 2`, "", false, false, ""}, + {`117.2`, `print nil and 2.5`, "", false, false, ""}, + {`117.3`, `print nil and true`, "", false, false, ""}, + {`117.4`, `print nil and "ab"`, "", false, false, ""}, + {`117.5`, `print nil and nil`, "", false, false, ""}, + {`120`, `def b{x}`, "", false, true, "'x' not resolved as var or field"}, + {`121.1`, `print 1/0`, "", false, true, "division by int zero"}, + {`121.2`, `print 1/0.0`, "+Inf", false, false, ""}, } for _, tc := range tab {