aboutsummaryrefslogtreecommitdiff
path: root/stdlib/test
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/test')
-rw-r--r--stdlib/test/test/lux/data/number.lux18
1 files changed, 18 insertions, 0 deletions
diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux
index 3ba7db2c2..263dd346d 100644
--- a/stdlib/test/test/lux/data/number.lux
+++ b/stdlib/test/test/lux/data/number.lux
@@ -163,3 +163,21 @@
#let [sample (|> factor nat-to-int int-to-frac (f/* raw))]]
(test "Can convert frac values to/from their bit patterns."
(|> sample frac-to-bits bits-to-frac (f/= sample))))))
+
+(context: "Macros for alternative numeric encodings."
+ ($_ seq
+ (test "Binary."
+ (and (n/= (bin "+11001001") (bin "+11_00_10_01"))
+ (i/= (bin "11001001") (bin "11_00_10_01"))
+ (d/= (bin ".11001001") (bin ".11_00_10_01"))
+ (f/= (bin "1100.1001") (bin "11_00.10_01"))))
+ (test "Octal."
+ (and (n/= (oct "+615243") (oct "+615_243"))
+ (i/= (oct "615243") (oct "615_243"))
+ (d/= (oct ".615243") (oct ".615_243"))
+ (f/= (oct "6152.43") (oct "615_2.43"))))
+ (test "Hexadecimal."
+ (and (n/= (hex "+deadBEEF") (hex "+dead_BEEF"))
+ (i/= (hex "deadBEEF") (hex "dead_BEEF"))
+ (d/= (hex ".deadBEEF") (hex ".dead_BEEF"))
+ (f/= (hex "deadBE.EF") (hex "dead_BE.EF"))))))