mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
update tests for right shift
This commit is contained in:
parent
f02e9fd4d0
commit
d1b9216ee1
@ -1320,35 +1320,38 @@ func TestSyntaxOperatorShift(t *testing.T) {
|
||||
stmt string
|
||||
err bool
|
||||
}{
|
||||
{stmt: "s := 1; a := 1.0<<s + vec2(1); _ = a", err: true},
|
||||
{stmt: "s := 1; a := 1.0<<s + ivec2(1); _ = a", err: false},
|
||||
{stmt: "s := 1; a := 1.0<<s + foo_int_int(1.0<<s); _ = a", err: false},
|
||||
{stmt: "s := 1; a := 1.0<<s + 1.0<<s; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 1<<s + 1.0<<s; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 1.0<<s + 1<<s; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 1<<s + 1<<s; _ = a", err: false},
|
||||
{stmt: "s := 1; foo_multivar(0, 0, 1<<s)", err: false},
|
||||
{stmt: "s := 1; foo_multivar(0, 1.0<<s, 0)", err: true},
|
||||
{stmt: "s := 1; foo_multivar(1.0<<s, 0, 0)", err: false},
|
||||
{stmt: "s := 12; a := foo_multivar(1.0<<s, 0, 0); _ = a", err: false},
|
||||
{stmt: "s := 12; a := foo_multivar(0, 1.0<<s, 0); _ = a", err: true},
|
||||
{stmt: "s := 12; a := foo_multivar(0, 0, 1.0<<s); _ = a", err: false},
|
||||
{stmt: "b := 2.0; a := 1.0 << 2.0 == b; _ = a", err: false},
|
||||
{stmt: "s := 1; b := 2.0; a := 1.0<<s == b; _ = a", err: true},
|
||||
{stmt: "s := 1; b := 2; a := 1.0<<s == b; _ = a", err: false},
|
||||
{stmt: "s := 1; a := 2.0<<s + ivec2(3.0<<s); _ = a", err: false},
|
||||
{stmt: "s := 1; a := 2.0<<s + vec2(3); _ = a", err: true},
|
||||
{stmt: "s := 1; a := 2.0<<s + ivec2(3); _ = a", err: false},
|
||||
{stmt: "s := 1; a := 2.0<<s + foo_int_int(3.0<<s); _ = a", err: false},
|
||||
{stmt: "s := 1; a := 2.0<<s + 3.0<<s; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 2<<s + 3.0<<s; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 2.0<<s + 3<<s; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 2<<s + 3<<s; _ = a", err: false},
|
||||
{stmt: "s := 1; foo_multivar(0, 0, 2<<s)", err: false},
|
||||
{stmt: "s := 1; foo_multivar(0, 2.0<<s, 0)", err: true},
|
||||
{stmt: "s := 1; foo_multivar(2.0<<s, 0, 0)", err: false},
|
||||
{stmt: "s := 1; a := foo_multivar(2.0<<s, 0, 0); _ = a", err: false},
|
||||
{stmt: "s := 1; a := foo_multivar(0, 2.0<<s, 0); _ = a", err: true},
|
||||
{stmt: "s := 1; a := foo_multivar(0, 0, 2.0<<s); _ = a", err: false},
|
||||
{stmt: "a := foo_multivar(0, 0, 1.0<<2.0); _ = a", err: false},
|
||||
{stmt: "a := foo_multivar(0, 1.0<<2.0, 0); _ = a", err: false},
|
||||
{stmt: "s := 12; var a int = 1.0 << 2.0 << 3.0 << 4.0 << s; _ = a", err: false},
|
||||
{stmt: "s := 12; var a float = 1 << 1 << 1 << 1 << s; _ = a", err: true},
|
||||
{stmt: "s := 12; var a float = 1 << s + 1.2; _ = a", err: true},
|
||||
{stmt: "s := 12; a := 1.0 << s + 1.2; _ = a", err: true},
|
||||
{stmt: "s := 12; a := 1.0 << s + foo_float_float(2); _ = a", err: true},
|
||||
{stmt: "s := 12; a := 1.0 << s + foo_float_int(2); _ = a", err: false},
|
||||
{stmt: "s := 12; a := foo_float_int(1.0<<s) + foo_float_int(2); _ = a", err: true},
|
||||
{stmt: "s := 12; a := foo_int_float(1<<s) + foo_int_float(2); _ = a", err: false},
|
||||
{stmt: "s := 12; a := foo_int_int(1<<s) + foo_int_int(2); _ = a", err: false},
|
||||
{stmt: "s := 1; a := int(1) + 1.0<<s + int(float(1<<s)); _ = a", err: true},
|
||||
{stmt: "s := 1; var a int = 1.0 << 2.0 << 3.0 << 4.0 << s; _ = a", err: false},
|
||||
{stmt: "s := 1; var a float = 1 << 1 << 1 << 1 << s; _ = a", err: true},
|
||||
{stmt: "s := 1; var a float = 1 << s + 1.2; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 1.0 << s + 1.2; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 1.0 << s + foo_float_float(2); _ = a", err: true},
|
||||
{stmt: "s := 1; a := 1.0 << s + foo_float_int(2); _ = a", err: false},
|
||||
{stmt: "s := 1; a := foo_float_int(1.0<<s) + foo_float_int(2); _ = a", err: true},
|
||||
{stmt: "s := 1; a := foo_int_float(1<<s) + foo_int_float(2); _ = a", err: false},
|
||||
{stmt: "s := 1; a := foo_int_int(1<<s) + foo_int_int(2); _ = a", err: false},
|
||||
{stmt: "s := 1; t := 2.0; a := t + 1.0 << s; _ = a", err: true},
|
||||
{stmt: "s := 1; t := 2; a := t + 1.0 << s; _ = a", err: false},
|
||||
{stmt: "s := 1; b := 1 << s; _ = b", err: false},
|
||||
{stmt: "s := 1; a = 1.0 << s; _ = a", err: true},
|
||||
|
||||
{stmt: "var a = 1; b := a << 2.0; _ = b", err: false},
|
||||
{stmt: "s := 1; var a float; a = 1 << s; _ = a", err: true},
|
||||
{stmt: "s := 1; var a float = 1 << s; _ = a", err: true},
|
||||
@ -1363,7 +1366,6 @@ func TestSyntaxOperatorShift(t *testing.T) {
|
||||
{stmt: "s := 1; var a float = 1 << s; _ = a", err: true},
|
||||
{stmt: "s := 1; var a int = 1.0 << s; _ = a", err: false},
|
||||
{stmt: "s := 1; var a int = 1 << s; _ = a", err: false},
|
||||
|
||||
{stmt: "var a float = 1.0 << 2.0; _ = a", err: false},
|
||||
{stmt: "var a int = 1.0 << 2; _ = a", err: false},
|
||||
{stmt: "var a float = 1.0 << 2; _ = a", err: false},
|
||||
@ -1392,6 +1394,81 @@ func TestSyntaxOperatorShift(t *testing.T) {
|
||||
{stmt: "a := ivec2(1) << vec2(2); _ = a", err: true},
|
||||
{stmt: "a := vec3(1) << ivec2(2); _ = a", err: true},
|
||||
{stmt: "a := ivec2(1) << vec3(2); _ = a", err: true},
|
||||
|
||||
{stmt: "b := 2.0; a := 1.0 >> 2.0 == b; _ = a", err: false},
|
||||
{stmt: "s := 1; b := 2.0; a := 1.0>>s == b; _ = a", err: true},
|
||||
{stmt: "s := 1; b := 2; a := 1.0>>s == b; _ = a", err: false},
|
||||
{stmt: "s := 1; a := 2.0>>s + ivec2(3.0>>s); _ = a", err: false},
|
||||
{stmt: "s := 1; a := 2.0>>s + vec2(3); _ = a", err: true},
|
||||
{stmt: "s := 1; a := 2.0>>s + ivec2(3); _ = a", err: false},
|
||||
{stmt: "s := 1; a := 2.0>>s + foo_int_int(3.0>>s); _ = a", err: false},
|
||||
{stmt: "s := 1; a := 2.0>>s + 3.0>>s; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 2>>s + 3.0>>s; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 2.0>>s + 3>>s; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 2>>s + 3>>s; _ = a", err: false},
|
||||
{stmt: "s := 1; foo_multivar(0, 0, 2>>s)", err: false},
|
||||
{stmt: "s := 1; foo_multivar(0, 2.0>>s, 0)", err: true},
|
||||
{stmt: "s := 1; foo_multivar(2.0>>s, 0, 0)", err: false},
|
||||
{stmt: "s := 1; a := foo_multivar(2.0>>s, 0, 0); _ = a", err: false},
|
||||
{stmt: "s := 1; a := foo_multivar(0, 2.0>>s, 0); _ = a", err: true},
|
||||
{stmt: "s := 1; a := foo_multivar(0, 0, 2.0>>s); _ = a", err: false},
|
||||
{stmt: "a := foo_multivar(0, 0, 1.0>>2.0); _ = a", err: false},
|
||||
{stmt: "a := foo_multivar(0, 1.0>>2.0, 0); _ = a", err: false},
|
||||
{stmt: "s := 1; a := int(1) + 1.0>>s + int(float(1>>s)); _ = a", err: true},
|
||||
{stmt: "s := 1; var a int = 1.0 >> 2.0 >> 3.0 >> 4.0 >> s; _ = a", err: false},
|
||||
{stmt: "s := 1; var a float = 1 >> 1 >> 1 >> 1 >> s; _ = a", err: true},
|
||||
{stmt: "s := 1; var a float = 1 >> s + 1.2; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 1.0 >> s + 1.2; _ = a", err: true},
|
||||
{stmt: "s := 1; a := 1.0 >> s + foo_float_float(2); _ = a", err: true},
|
||||
{stmt: "s := 1; a := 1.0 >> s + foo_float_int(2); _ = a", err: false},
|
||||
{stmt: "s := 1; a := foo_float_int(1.0>>s) + foo_float_int(2); _ = a", err: true},
|
||||
{stmt: "s := 1; a := foo_int_float(1>>s) + foo_int_float(2); _ = a", err: false},
|
||||
{stmt: "s := 1; a := foo_int_int(1>>s) + foo_int_int(2); _ = a", err: false},
|
||||
{stmt: "s := 1; t := 2.0; a := t + 1.0 >> s; _ = a", err: true},
|
||||
{stmt: "s := 1; t := 2; a := t + 1.0 >> s; _ = a", err: false},
|
||||
{stmt: "s := 1; b := 1 >> s; _ = b", err: false},
|
||||
{stmt: "var a = 1; b := a >> 2.0; _ = b", err: false},
|
||||
{stmt: "s := 1; var a float; a = 1 >> s; _ = a", err: true},
|
||||
{stmt: "s := 1; var a float = 1 >> s; _ = a", err: true},
|
||||
{stmt: "s := 1; var a float = float(1.0 >> s); _ = a", err: true},
|
||||
{stmt: "s := 1; var a int = int(1 >> s); _ = a", err: false},
|
||||
{stmt: "s := 1; var a int = int(1.0 >> s); _ = a", err: false},
|
||||
{stmt: "s := 1; a := 1 >> s; _ = a", err: false},
|
||||
{stmt: "s := 1; a := 1.0 >> s; _ = a", err: true},
|
||||
{stmt: "s := 1; a := int(1.0 >> s); _ = a", err: false},
|
||||
{stmt: "s := 1; var a float = float(1.0 >> s); _ = a", err: true},
|
||||
{stmt: "s := 1; var a float = 1.0 >> s; _ = a", err: true},
|
||||
{stmt: "s := 1; var a float = 1 >> s; _ = a", err: true},
|
||||
{stmt: "s := 1; var a int = 1.0 >> s; _ = a", err: false},
|
||||
{stmt: "s := 1; var a int = 1 >> s; _ = a", err: false},
|
||||
{stmt: "var a float = 1.0 >> 2.0; _ = a", err: false},
|
||||
{stmt: "var a int = 1.0 >> 2; _ = a", err: false},
|
||||
{stmt: "var a float = 1.0 >> 2; _ = a", err: false},
|
||||
{stmt: "a := 1 >> 2.0; _ = a", err: false},
|
||||
{stmt: "a := 1.0 >> 2; _ = a", err: false},
|
||||
{stmt: "a := 1.0 >> 2.0; _ = a", err: false},
|
||||
{stmt: "a := 1 >> 2; _ = a", err: false},
|
||||
{stmt: "a := float(1.0) >> 2; _ = a", err: true},
|
||||
{stmt: "a := 1 >> float(2.0); _ = a", err: false},
|
||||
{stmt: "a := 1.0 >> float(2.0); _ = a", err: false},
|
||||
{stmt: "a := ivec2(1) >> 2; _ = a", err: false},
|
||||
{stmt: "a := 1 >> ivec2(2); _ = a", err: true},
|
||||
{stmt: "a := ivec2(1) >> float(2.0); _ = a", err: true},
|
||||
{stmt: "a := float(1.0) >> ivec2(2); _ = a", err: true},
|
||||
{stmt: "a := ivec2(1) >> ivec2(2); _ = a", err: false},
|
||||
{stmt: "a := ivec3(1) >> ivec2(2); _ = a", err: true},
|
||||
{stmt: "a := ivec2(1) >> ivec3(2); _ = a", err: true},
|
||||
{stmt: "a := 1 >> vec2(2); _ = a", err: true},
|
||||
{stmt: "a := vec2(1) >> 2; _ = a", err: true},
|
||||
{stmt: "a := float(1.0) >> vec2(2); _ = a", err: true},
|
||||
{stmt: "a := vec2(1) >> float(2.0); _ = a", err: true},
|
||||
{stmt: "a := vec2(1) >> vec2(2); _ = a", err: true},
|
||||
{stmt: "a := vec2(1) >> vec3(2); _ = a", err: true},
|
||||
{stmt: "a := vec3(1) >> vec2(2); _ = a", err: true},
|
||||
{stmt: "a := vec2(1) >> ivec2(2); _ = a", err: true},
|
||||
{stmt: "a := ivec2(1) >> vec2(2); _ = a", err: true},
|
||||
{stmt: "a := vec3(1) >> ivec2(2); _ = a", err: true},
|
||||
{stmt: "a := ivec2(1) >> vec3(2); _ = a", err: true},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
|
Loading…
Reference in New Issue
Block a user