diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-11-05 15:18:32 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-11-05 15:18:32 -0500 |
| commit | b8d7eabc023bf9db0150049d8e909086f6ad91bc (patch) | |
| tree | 5b678c7949638b3f07095affc04611f0422ef8c7 /test | |
| parent | 2fa26e6af3ec1599396d9260ef44b0d035b1f686 (diff) | |
Deprecate bit-width integer/num literals in favor of using type
constructors
Diffstat (limited to 'test')
| -rw-r--r-- | test/bytes.tm | 8 | ||||
| -rw-r--r-- | test/datetime.tm | 4 | ||||
| -rw-r--r-- | test/inline_c.tm | 2 | ||||
| -rw-r--r-- | test/integers.tm | 36 | ||||
| -rw-r--r-- | test/lang.tm | 2 | ||||
| -rw-r--r-- | test/nums.tm | 4 | ||||
| -rw-r--r-- | test/optionals.tm | 6 | ||||
| -rw-r--r-- | test/paths.tm | 2 | ||||
| -rw-r--r-- | test/rng.tm | 14 | ||||
| -rw-r--r-- | test/text.tm | 14 |
10 files changed, 46 insertions, 46 deletions
diff --git a/test/bytes.tm b/test/bytes.tm index 4db94930..be6d1cdd 100644 --- a/test/bytes.tm +++ b/test/bytes.tm @@ -1,8 +1,8 @@ func main(): !! Test bytes: - >> 100[B] - = 100[B] + >> Byte(100) + = Byte(0x64) - >> 0xFF[B] - = 255[B] + >> Byte(0xFF) + = Byte(0xFF) diff --git a/test/datetime.tm b/test/datetime.tm index 19ca74b0..64077c27 100644 --- a/test/datetime.tm +++ b/test/datetime.tm @@ -36,8 +36,8 @@ func main(): = "Tuesday" >> t:unix_timestamp() - = 1704221100[64] - >> t == DateTime.from_unix_timestamp(1704221100[64]) + = Int64(1704221100) + >> t == DateTime.from_unix_timestamp(1704221100) = yes >> t < t:after(minutes=1) diff --git a/test/inline_c.tm b/test/inline_c.tm index 876e78fd..3c0949cd 100644 --- a/test/inline_c.tm +++ b/test/inline_c.tm @@ -1,7 +1,7 @@ func main(): >> inline C:Int32 { int x = 1 + 2; x } - = 3[32] + = Int32(3) >> inline C { say(Text("Inline C code works!"), true); diff --git a/test/integers.tm b/test/integers.tm index ad9c40d7..323508da 100644 --- a/test/integers.tm +++ b/test/integers.tm @@ -11,21 +11,21 @@ func main(): >> 2 * 3 + 4 = 10 - >> 1[8] + 2[16] - = 3[16] + >> Int8(1) + Int16(2) + = Int16(3) >> 1 << 10 = 1024 !! Signed and unsigned bit shifting: - >> -2[64] << 1 - = -4[64] - >> -2[64] <<< 1 - = -4[64] - >> -2[64] >> 1 - = -1[64] - >> -2[64] >>> 1 - = 9223372036854775807[64] + >> Int64(-2) << 1 + = Int64(-4) + >> Int64(-2) <<< 1 + = Int64(-4) + >> Int64(-2) >> 1 + = Int64(-1) + >> Int64(-2) >>> 1 + = Int64(9223372036854775807) >> 3 and 2 = 2 @@ -42,7 +42,7 @@ func main(): >> nums = "1,2,3,4,5," - >> x := 123[64] + >> x := Int64(123) >> x:format(digits=5) = "00123" >> x:hex() @@ -51,16 +51,16 @@ func main(): = "0o173" >> Int64.min - = -9223372036854775808[64] + = Int64(-9223372036854775808) >> Int64.max - = 9223372036854775807[64] + = Int64(9223372036854775807) - >> 123[32]:hex() + >> Int32(123):hex() = "0x7B" - >> 123[16]:hex() + >> Int16(123):hex() = "0x7B" - >> 123[8]:hex() + >> Int8(123):hex() = "0x7B" >> Int(2.1) @@ -127,6 +127,6 @@ func main(): = 0 >> Int64(yes) - = 1[64] + = Int64(1) >> Int64(no) - = 0[64] + = Int64(0) diff --git a/test/lang.tm b/test/lang.tm index b30bcbea..509071a4 100644 --- a/test/lang.tm +++ b/test/lang.tm @@ -33,7 +33,7 @@ func main(): >> $HTML"$(1 + 2)" = $HTML"3" - >> $HTML"$(3[8])" + >> $HTML"$(Int8(3))" = $HTML"3" >> html:paragraph() diff --git a/test/nums.tm b/test/nums.tm index 32c55f3b..98bcd9cd 100644 --- a/test/nums.tm +++ b/test/nums.tm @@ -41,8 +41,8 @@ func main(): >> Num.INF:near(-Num.INF) = no - >> Num32.sqrt(16f32) - = 4_f32 + >> Num32.sqrt(16) + = Num32(4) >> 0.25:mix(10, 20) = 12.5 diff --git a/test/optionals.tm b/test/optionals.tm index 612ab76b..cf9284e1 100644 --- a/test/optionals.tm +++ b/test/optionals.tm @@ -21,7 +21,7 @@ func maybe_int(should_i:Bool->Int?): func maybe_int64(should_i:Bool->Int64?): if should_i: - return 123[64] + return Int64(123) else: return !Int64 @@ -113,12 +113,12 @@ func main(): !! ... !! Int64s: >> yep := maybe_int64(yes) - = 123[64]? + = Int64(123)? >> nope := maybe_int64(no) = !Int64 >> if yep: >> yep - = 123[64] + = Int64(123) else: fail("Falsey: $yep") >> if nope: fail("Truthy: $nope") diff --git a/test/paths.tm b/test/paths.tm index 4330e79f..6c1ee5f2 100644 --- a/test/paths.tm +++ b/test/paths.tm @@ -25,7 +25,7 @@ func main(): >> tmpfile:read() = "Hello world!"? >> tmpfile:read_bytes() - = [72[B], 101[B], 108[B], 108[B], 111[B], 32[B], 119[B], 111[B], 114[B], 108[B], 100[B], 33[B]]? + = [Byte(0x48), Byte(0x65), Byte(0x6C), Byte(0x6C), Byte(0x6F), Byte(0x20), Byte(0x77), Byte(0x6F), Byte(0x72), Byte(0x6C), Byte(0x64), Byte(0x21)]? : [Byte]? >> tmpdir:files():has(tmpfile) = yes diff --git a/test/rng.tm b/test/rng.tm index 3285cd0f..3f477d57 100644 --- a/test/rng.tm +++ b/test/rng.tm @@ -12,23 +12,23 @@ func main(): >> rng:int(1, 1000) = 921 >> rng:int64(1, 1000) - = 324[64] + = Int64(324) >> rng:int32(1, 1000) - = 586[32] + = Int32(586) >> rng:int16(1, 1000) - = 453[16] + = Int16(453) >> rng:int8(1, 100) - = 53[8] + = Int8(53) >> rng:byte() - = 220[B] + = Byte(0xDC) >> rng:bytes(10) - = [160[B], 90[B], 16[B], 63[B], 108[B], 209[B], 53[B], 194[B], 135[B], 140[B]] + = [Byte(0xA0), Byte(0x5A), Byte(0x10), Byte(0x3F), Byte(0x6C), Byte(0xD1), Byte(0x35), Byte(0xC2), Byte(0x87), Byte(0x8C)] >> rng:bool(p=0.8) = yes >> rng:num() = 0.03492503353647658 >> rng:num32(1, 1000) - = 761.05908_f32 + = Num32(761.05908) !! Random array methods: >> nums := [10*i for i in 10] diff --git a/test/text.tm b/test/text.tm index 73b9f952..6ecd211b 100644 --- a/test/text.tm +++ b/test/text.tm @@ -29,21 +29,21 @@ func main(): >> amelie:split() = ["A", "m", "é", "l", "i", "e"] : [Text] >> amelie:utf32_codepoints() - = [65[32], 109[32], 233[32], 108[32], 105[32], 101[32]] : [Int32] + = [Int32(65), Int32(109), Int32(233), Int32(108), Int32(105), Int32(101)] >> amelie:utf8_bytes() - = [65[B], 109[B], 195[B], 169[B], 108[B], 105[B], 101[B]] : [Byte] - >> Text.from_bytes([65[B], 109[B], 195[B], 169[B], 108[B], 105[B], 101[B]])! + = [Byte(0x41), Byte(0x6D), Byte(0xC3), Byte(0xA9), Byte(0x6C), Byte(0x69), Byte(0x65)] + >> Text.from_bytes([:Byte 0x41, 0x6D, 0xC3, 0xA9, 0x6C, 0x69, 0x65])! = "Amélie" - >> Text.from_bytes([255[B]]) + >> Text.from_bytes([Byte(0xFF)]) = !Text >> amelie2 := "Am$(\U65\U301)lie" >> amelie2:split() = ["A", "m", "é", "l", "i", "e"] : [Text] >> amelie2:utf32_codepoints() - = [65[32], 109[32], 233[32], 108[32], 105[32], 101[32]] : [Int32] + = [Int32(65), Int32(109), Int32(233), Int32(108), Int32(105), Int32(101)] >> amelie2:utf8_bytes() - = [65[B], 109[B], 195[B], 169[B], 108[B], 105[B], 101[B]] : [Byte] + = [Byte(0x41), Byte(0x6D), Byte(0xC3), Byte(0xA9), Byte(0x6C), Byte(0x69), Byte(0x65)] >> amelie:codepoint_names() = ["LATIN CAPITAL LETTER A", "LATIN SMALL LETTER M", "LATIN SMALL LETTER E WITH ACUTE", "LATIN SMALL LETTER L", "LATIN SMALL LETTER I", "LATIN SMALL LETTER E"] @@ -216,7 +216,7 @@ func main(): >> house:codepoint_names() = ["CJK Unified Ideographs-5BB6"] >> house:utf32_codepoints() - = [23478[32]] + = [Int32(23478)] >> "🐧":codepoint_names() = ["PENGUIN"] |
