<<
path:
root/public/0x2lib.git/html/tests/math.jai
blob: 96b8f57cd06fb55b90bd061189bae663cf9caf4e
[raw]
[clear marker]
10 { "top left", ROOT, { 2.0, 2.0 }, .TOP | .LEFT, { 0.0, 0.0, 200.0, 200.0 } },
11 { "top right", ROOT, { 2.0, 2.0 }, .TOP | .RIGHT, { -100.0, 0.0, 200.0, 200.0 } },
12 { "top mid", ROOT, { 2.0, 2.0 }, .TOP | .MID, { -50.0, 0.0, 200.0, 200.0 } },
13 { "mid left", ROOT, { 2.0, 2.0 }, .MID | .LEFT, { 0.0, -50.0, 200.0, 200.0 } },
14 { "mid right", ROOT, { 2.0, 2.0 }, .MID | .RIGHT, { -100.0, -50.0, 200.0, 200.0 } },
15 { "mid (none)", ROOT, { 2.0, 2.0 }, .NONE, { -50.0, -50.0, 200.0, 200.0 } },
16 { "mid", ROOT, { 2.0, 2.0 }, .MID, { -50.0, -50.0, 200.0, 200.0 } },
17 { "bot left", ROOT, { 2.0, 2.0 }, .BOTTOM | .LEFT, { 0.0, -100.0, 200.0, 200.0 } },
18 { "bot right", ROOT, { 2.0, 2.0 }, .BOTTOM | .RIGHT, { -100.0, -100.0, 200.0, 200.0 } },
19 { "bot mid", ROOT, { 2.0, 2.0 }, .BOTTOM | .MID, { -50.0, -100.0, 200.0, 200.0 } },
23 log_error("\n%: Test failed: '%'", loc, `it.label);
24 log_error("-------------------");
25 log_error(":Given\n%\n\n", a);
26 log_error(":Expected\n%\n\n", b);
32 x: float; /** top-left corner position x */
33 y: float; /** top-left corner position y */
47operator == :: (a: Rectangle, b: Rectangle) -> bool {
51 result &= a.width == b.width;
52 result &= a.height == b.height;
59 new := rect_scale(it.root, it.scale, it.origin);
60 #if false then log_vars(it.label, new);
61 ass(new, it.expected, MY_ASS_CODE);
64 /** Test with pointer */
66 test :: TESTS[TESTS.count-1];
67 rect_scale(*root, test.scale, test.origin);
68 ass(root == test.expected);
77#import,file "../0x2_Math.jai";