1uniform half4 colorGreen, colorRed;
2
3bool test_fvec() {
4    const float one = 1;
5    float two = 2;
6    const half4 one_splat = half4(1);
7    const half4 one_compound = half4(1, 1, 1, 1);
8
9    bool ok = true;
10    ok = ok && (half4(-1) == -one_splat);
11    ok = ok && (half4(-1, -1, -1, -1) == -one_splat);
12    ok = ok && (half4(-1) == -one_compound);
13    ok = ok && (half4(-1, -1, -1, -1) == -one_compound);
14    ok = ok && (-half4(1) == -one_splat);
15    ok = ok && (-half4(1, 1, 1, 1) == -one_splat);
16    ok = ok && (-half4(1) == -one_compound);
17    ok = ok && (-half4(1, 1, 1, 1) == -one_compound);
18    ok = ok && (half4(-1) == -one_compound);
19    ok = ok && (half4(-1) == -half4(-half2(-1), half2(1)));
20    ok = ok && (half4(1) != -half4(1));
21    ok = ok && (-half4(two) == half4(-two, half3(-two)));
22    ok = ok && (-half2(-one, one + one) == -half2(one - two, two));
23    return ok;
24}
25
26bool test_ivec() {
27    int one = 1;
28    const int two = 2;
29    const int4 one_splat = int4(1);
30    const int4 one_compound = int4(1, 1, 1, 1);
31
32    bool ok = true;
33    ok = ok && (int4(-1) == -one_splat);
34    ok = ok && (int4(-1, -1, -1, -1) == -one_splat);
35    ok = ok && (int4(-1) == -one_compound);
36    ok = ok && (int4(-1, -1, -1, -1) == -one_compound);
37    ok = ok && (-int4(1) == -one_splat);
38    ok = ok && (-int4(1, 1, 1, 1) == -one_splat);
39    ok = ok && (-int4(1) == -one_compound);
40    ok = ok && (-int4(1, 1, 1, 1) == -one_compound);
41    ok = ok && (int4(-1) == -int4(-int2(-1), int2(1)));
42    ok = ok && (int4(1) != -int4(1));
43    ok = ok && (-int4(two) == int4(-two, int3(-two)));
44    ok = ok && (-int2(-one, one + one) == -int2(one - two, two));
45    return ok;
46}
47
48bool test_mat() {
49    const float3x3 one_diagonal = float3x3(1);
50    const float3x3 one_compound = float3x3(1, 0, 0,
51                                           0, 1, 0,
52                                           0, 0, 1);
53    bool ok = true;
54    ok = ok && (float3x3(-1) == -one_diagonal);
55    ok = ok && (float3x3(-1, 0, 0, 0, -1, 0, 0, 0, -1) == -one_diagonal);
56    ok = ok && (float3x3(-1) == -one_compound);
57    ok = ok && (float3x3(-1, 0, 0, 0, -1, 0, 0, 0, -1) == -one_compound);
58    ok = ok && (-float3x3(1) == -one_diagonal);
59    ok = ok && (-float3x3(1, 0, 0, 0, 1, 0, 0, 0, 1) == -one_diagonal);
60    ok = ok && (-float3x3(1) == -one_compound);
61    ok = ok && (-float3x3(1, 0, 0, 0, 1, 0, 0, 0, 1) == -one_compound);
62    return ok;
63}
64
65half4 main(float2 coords) {
66    return test_fvec() && test_ivec() && test_mat() ? colorGreen : colorRed;
67}
68