48 lines
1.1 KiB
Plaintext
48 lines
1.1 KiB
Plaintext
(module main)
|
|
|
|
(fn u32_zero_text () -> string
|
|
(std.num.u32_to_string 0u32))
|
|
|
|
(fn u32_high_text () -> string
|
|
(std.num.u32_to_string 4294967295u32))
|
|
|
|
(fn u64_zero_text () -> string
|
|
(std.num.u64_to_string 0u64))
|
|
|
|
(fn u64_high_text () -> string
|
|
(std.num.u64_to_string 18446744073709551615u64))
|
|
|
|
(fn u64_beyond_u32_text () -> string
|
|
(std.num.u64_to_string 4294967296u64))
|
|
|
|
(test "u32 zero to string"
|
|
(= (u32_zero_text) "0"))
|
|
|
|
(test "u32 high to string"
|
|
(= (u32_high_text) "4294967295"))
|
|
|
|
(test "u32 high string length"
|
|
(= (std.string.len (u32_high_text)) 10))
|
|
|
|
(test "u64 zero to string"
|
|
(= (u64_zero_text) "0"))
|
|
|
|
(test "u64 high to string"
|
|
(= (u64_high_text) "18446744073709551615"))
|
|
|
|
(test "u64 beyond u32 to string"
|
|
(= (u64_beyond_u32_text) "4294967296"))
|
|
|
|
(test "u64 high string length"
|
|
(= (std.string.len (u64_high_text)) 20))
|
|
|
|
(fn main () -> i32
|
|
(std.io.print_string (u32_zero_text))
|
|
(std.io.print_string (u32_high_text))
|
|
(std.io.print_string (u64_zero_text))
|
|
(std.io.print_string (u64_high_text))
|
|
(std.io.print_string (u64_beyond_u32_text))
|
|
(if (= (std.string.len (u64_beyond_u32_text)) 10)
|
|
0
|
|
1))
|