aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-28 15:30:11 +0900
committernsfisis <nsfisis@gmail.com>2025-09-28 15:30:11 +0900
commit5a16856f8ff4dbf801b4a622ca7053b77e8a0214 (patch)
treea5f15bccc7b34802da8aa655d26c28848a832cff /tests
parent1b208f7f0a3b7d6b72c2a431d9fcd6e18fe76f5d (diff)
downloadducc-5a16856f8ff4dbf801b4a622ca7053b77e8a0214.tar.gz
ducc-5a16856f8ff4dbf801b4a622ca7053b77e8a0214.tar.zst
ducc-5a16856f8ff4dbf801b4a622ca7053b77e8a0214.zip
feat: implement bitwise not operator
Diffstat (limited to 'tests')
-rw-r--r--tests/test_bitwise_operators.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_bitwise_operators.sh b/tests/test_bitwise_operators.sh
index fe1f245..f683099 100644
--- a/tests/test_bitwise_operators.sh
+++ b/tests/test_bitwise_operators.sh
@@ -25,5 +25,16 @@ int main() {
ASSERT_EQ(2, d);
ASSERT_EQ(3, e);
ASSERT_EQ(0, f);
+
+ ASSERT_EQ(-1, ~0);
+ ASSERT_EQ(-2, ~1);
+ ASSERT_EQ(-6, ~5);
+ ASSERT_EQ(0, ~(-1));
+ ASSERT_EQ(5, ~(-6));
+
+ int x = 10;
+ ASSERT_EQ(-11, ~x);
+ ASSERT_EQ(-1, ~(x & 0));
+ ASSERT_EQ(-16, ~(x | 5));
}
EOF