resolve TODO: test C23 base-2 literals

Wed, 01 Oct 2025 22:43:48 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 01 Oct 2025 22:43:48 +0200
changeset 1410
be4071f5e9aa
parent 1409
6856869e29f1
child 1411
838796848e12

resolve TODO: test C23 base-2 literals

tests/test_string.c file | annotate | diff | comparison | revisions
--- a/tests/test_string.c	Tue Sep 30 22:35:24 2025 +0200
+++ b/tests/test_string.c	Wed Oct 01 22:43:48 2025 +0200
@@ -1065,7 +1065,11 @@
         test_strtoint_rollout_signed(0x6df9CE03, 16);
         test_strtoint_rollout_signed(0xFdf9CE03, 16);
         test_strtoint_rollout_signed(0x6df9CE03AbC90815, 16);
-        // TODO: roll out base 2 tests, but that needs C23
+#if __STDC_VERSION__ >= 202300L
+        test_strtoint_rollout_signed(0b01000010100100101110101001110101, 2);
+        test_strtoint_rollout_signed(0b00011010101100001111111001010100, 2);
+        test_strtoint_rollout_signed(0b10110001001001010001010111010011, 2);
+#endif
 
         // do some special case tests
         // --------------------------
@@ -1154,7 +1158,11 @@
         test_strtoint_rollout(0xFdf9CE03, 16);
         test_strtoint_rollout(0x6df9CE03AbC90815, 16);
         test_strtoint_rollout(0xfdf9CE03AbC90815, 16);
-        // TODO: roll out base 2 tests, but that needs C23
+#if __STDC_VERSION__ >= 202300L
+        test_strtoint_rollout(0b01000010100100101110101001110101, 2);
+        test_strtoint_rollout(0b00011010101100001111111001010100, 2);
+        test_strtoint_rollout(0b10110001001001010001010111010011, 2);
+#endif
 
         // do some special case tests
         // --------------------------

mercurial