X-Git-Url: https://pd.if.org/git/?p=lice;a=blobdiff_plain;f=tests%2Fcompound.c;fp=tests%2Fcompound.c;h=9fa7099229e1792f979dbba08ef8c76ff6537ee8;hp=0000000000000000000000000000000000000000;hb=f1abb26903687c7967cf37c3f6c830051bdeb371;hpb=bb650f4a52a456c1aa0a34508d6f3dcce58291b6 diff --git a/tests/compound.c b/tests/compound.c new file mode 100644 index 0000000..9fa7099 --- /dev/null +++ b/tests/compound.c @@ -0,0 +1,19 @@ +// compound assignment + +int main(void) { + int a = 5; + expecti((a += 5), 10); + expecti((a -= 5), 5); + expecti((a *= 5), 25); + expecti((a /= 5), 5); + expecti((a %= 3), 2); + + int b = 14; + expecti((b &= 7), 6); + expecti((b |= 8), 14); + expecti((b ^= 3), 13); + expecti((b <<= 2), 52); + expecti((b >>= 2), 13); + + return 0; +}