aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-28 10:35:44 +0900
committernsfisis <nsfisis@gmail.com>2025-09-28 10:35:44 +0900
commit931cbe657ccdcfefe4077cd7371f1ea4ad4e5b53 (patch)
treefe0950e80e3ff1a6a559ac4b169a6991131816a9 /tests
parent86ae353d6267387bf216d5fd760a7ced7bced402 (diff)
downloadducc-931cbe657ccdcfefe4077cd7371f1ea4ad4e5b53.tar.gz
ducc-931cbe657ccdcfefe4077cd7371f1ea4ad4e5b53.tar.zst
ducc-931cbe657ccdcfefe4077cd7371f1ea4ad4e5b53.zip
feat: implement |=, &=, ^=, <<= and >>= operators
Diffstat (limited to 'tests')
-rw-r--r--tests/test_assignment_operators.sh40
1 files changed, 39 insertions, 1 deletions
diff --git a/tests/test_assignment_operators.sh b/tests/test_assignment_operators.sh
index 541abc8..9b3a33e 100644
--- a/tests/test_assignment_operators.sh
+++ b/tests/test_assignment_operators.sh
@@ -21,6 +21,44 @@ int main() {
z %= 7;
ASSERT_EQ(3, z);
- return 0;
+ int a = 0x05;
+ a |= 0x0A;
+ ASSERT_EQ(0x0F, a);
+
+ int b = 0x0F;
+ b &= 0x0A;
+ ASSERT_EQ(0x0A, b);
+
+ int c = 7;
+ c |= 8;
+ ASSERT_EQ(15, c);
+
+ int d = 15;
+ d &= 6;
+ ASSERT_EQ(6, d);
+
+ int e = 0x0F;
+ e ^= 0x05;
+ ASSERT_EQ(0x0A, e);
+
+ int f = 3;
+ f <<= 2;
+ ASSERT_EQ(12, f);
+
+ int g = 16;
+ g >>= 2;
+ ASSERT_EQ(4, g);
+
+ int h = -16;
+ h >>= 2;
+ ASSERT_EQ(-4, h);
+
+ int j = 1;
+ j <<= 4;
+ ASSERT_EQ(16, j);
+
+ int k = 64;
+ k >>= 3;
+ ASSERT_EQ(8, k);
}
EOF