diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-01-25 23:44:16 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-01-25 23:44:16 -0700 |
| commit | b215a3e0b6b3d79f4ffdaf3a092b8aa283aafb7b (patch) | |
| tree | 39ebaeb1276982a2df727cdf01cf3273aba33b74 /test | |
| parent | a37bb4a4dafa8e3e3b1e9e3bbd07e5cf4eee129b (diff) | |
| download | zig-b215a3e0b6b3d79f4ffdaf3a092b8aa283aafb7b.tar.gz zig-b215a3e0b6b3d79f4ffdaf3a092b8aa283aafb7b.zip | |
add constant expression evaluation for negation
Diffstat (limited to 'test')
| -rw-r--r-- | test/run_tests.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index d02ffbecae..daf3fa4cc9 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1286,6 +1286,28 @@ pub fn main(args: [][]u8) -> %void { %%stdout.printf("OK" ++ " IT " ++ "WORKED\n"); } )SOURCE", "OK IT WORKED\n"); + + add_simple_case("constant struct with negation", R"SOURCE( +import "std.zig"; +struct Vertex { + x: f32, + y: f32, + r: f32, + g: f32, + b: f32, +} +const vertices = []Vertex { + Vertex { .x = -0.6, .y = -0.4, .r = 1.0, .g = 0.0, .b = 0.0 }, + Vertex { .x = 0.6, .y = -0.4, .r = 0.0, .g = 1.0, .b = 0.0 }, + Vertex { .x = 0.0, .y = 0.6, .r = 0.0, .g = 0.0, .b = 1.0 }, +}; +pub fn main(args: [][]u8) -> %void { + if (vertices[0].x != -0.6) { + %%stdout.printf("BAD\n"); + } + %%stdout.printf("OK\n"); +} + )SOURCE", "OK\n"); } |
