aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/integers.tm9
-rw-r--r--test/nums.tm32
2 files changed, 41 insertions, 0 deletions
diff --git a/test/integers.tm b/test/integers.tm
index 2570521a..a3ec7fe2 100644
--- a/test/integers.tm
+++ b/test/integers.tm
@@ -33,6 +33,8 @@ for x in 5
= "1,2,3,4,5,"
>> x := 123
+>> x:format(digits=5)
+= "00123"
>> x:hex()
= "0x7B"
>> x:octal()
@@ -44,3 +46,10 @@ for x in 5
>> Int.max
= 9223372036854775807
+
+>> 123_i32:hex()
+= "0x7B"
+>> 123_i16:hex()
+= "0x7B"
+>> 123_i8:hex()
+= "0x7B"
diff --git a/test/nums.tm b/test/nums.tm
new file mode 100644
index 00000000..c5b19325
--- /dev/null
+++ b/test/nums.tm
@@ -0,0 +1,32 @@
+>> n := 1.5
+= 1.5
+
+>> n + n
+= 3
+
+>> n * 2
+= 3
+
+>> n - n
+= 0
+
+>> Num.PI
+= 3.14159
+
+>> Num.PI:format(precision=10)
+= "3.1415926536"
+
+>> Num.random()
+
+>> Num.INF
+= inf
+>> Num.INF:isinf()
+= yes
+
+>> Num.nan()
+= nan
+>> nan := Num.nan()
+>> nan:isnan()
+= yes
+>> nan == nan
+= no