authorgravatar for j@jadon.ioJadon Fowler <j@jadon.io> 2020-04-01 14:28:21-04:00
committergravatar for j@jadon.ioJadon Fowler <j@jadon.io> 2020-04-01 14:28:21-04:00
logb9cb1e0d837a9660b95a4476202baf1533614c9d
tree604c2fc47e9a6ab23fa305934a1a2049f0015ee2
parenta255b0f842cea070ae40bd62b77b63a3b256be75

translate-c: add tests for div & rem assignment

Signed-off-by: Jadon Fowler <j@jadon.io>

1 files changed, 12 insertions(+), 0 deletions(-)

test/translate_c.zig+12
......@@ -2381,6 +2381,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
23812381 \\ a &= (a &= 1);
23822382 \\ a |= (a |= 1);
23832383 \\ a ^= (a ^= 1);
2384 \\ a /= (a /= 1);
2385 \\ a %= (a %= 1);
23842386 \\ a >>= (a >>= 1);
23852387 \\ a <<= (a <<= 1);
23862388 \\}
......@@ -2417,6 +2419,16 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
24172419 \\ ref.* = ref.* ^ @as(c_int, 1);
24182420 \\ break :blk ref.*;
24192421 \\ });
2422 \\ a /= (blk: {
2423 \\ const ref = &a;
2424 \\ ref.* = ref.* / @as(c_int, 1);
2425 \\ break :blk ref.*;
2426 \\ });
2427 \\ a %= (blk: {
2428 \\ const ref = &a;
2429 \\ ref.* = ref.* % @as(c_int, 1);
2430 \\ break :blk ref.*;
2431 \\ });
24202432 \\ a >>= @intCast(@import("std").math.Log2Int(c_int), (blk: {
24212433 \\ const ref = &a;
24222434 \\ ref.* = ref.* >> @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1));