Skip to content

Commit

Permalink
Feedback and update health.
Browse files Browse the repository at this point in the history
  • Loading branch information
floitsch committed Feb 25, 2025
1 parent 2e425ae commit 5864a6a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
6 changes: 3 additions & 3 deletions lib/core/numbers.toit
Original file line number Diff line number Diff line change
Expand Up @@ -959,10 +959,10 @@ abstract class int extends num:
Treats the number as an unsigned 64-bit integer.
*/
stringify --unsigned-64/True -> string:
return stringify-unsigned-64_ this
stringify --uint64/True -> string:
return stringify-uint64_ this

static stringify-unsigned-64_ number/int -> string:
static stringify-uint64_ number/int -> string:
#primitive.core.uint64-to-string

/** See $super. */
Expand Down
2 changes: 1 addition & 1 deletion lib/core/string.toit
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ abstract class string implements Comparable io.Data:
d := object.to-float
meat = precision ? (d.stringify precision) : d.stringify
else if type == 'd': meat = object.to-int.stringify
else if type == 'u': meat = object.to-int.stringify --unsigned-64
else if type == 'u': meat = object.to-int.stringify --uint64
else if type == 'b': meat = printf-style-int-stringify_ object.to-int 2
else if type == 'o': meat = printf-style-int-stringify_ object.to-int 8
else if type == 'x': meat = printf-style-int-stringify_ object.to-int 16
Expand Down
46 changes: 23 additions & 23 deletions tests/health/gold/sdk/tests__number-test.toit.gold
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
tests/number-test.toit:258:32: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:259:32: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
expect-int-parsing-error: int.parse "1_123" 1
^~~~~~
tests/number-test.toit:259:32: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:260:32: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
expect-int-parsing-error: int.parse "1012_" 1
^~~~~~
tests/number-test.toit:260:32: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:261:32: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
expect-int-parsing-error: int.parse "1012_1" 1 5
^~~~~~
tests/number-test.toit:263:36: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:264:36: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-number-out-of-bounds: (int.parse "123" -1 --on-error=: throw it)
^~~~~~
tests/number-test.toit:264:36: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:265:36: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-number-out-of-bounds: (int.parse "123" 0 4 --on-error=: throw it)
^~~~~~
tests/number-test.toit:265:33: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:266:33: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-int-parsing-error: (int.parse "123" 0 0 --on-error=: throw it)
^~~~~~
tests/number-test.toit:269:10: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:270:10: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
int.parse "123" 1
^~~~~~
tests/number-test.toit:272:10: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:273:10: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
int.parse "1-23" 1
^~~~~~
tests/number-test.toit:275:10: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:276:10: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
int.parse "1-23" 2
^~~~~~
tests/number-test.toit:342:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:343:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-equals 16 (int.parse "foo10bar" --radix=16 3 5 --on-error=: throw it)
^~~~~~
tests/number-test.toit:343:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:344:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-equals 15 (int.parse "foo10bar" --radix=15 3 5 --on-error=: throw it)
^~~~~~
tests/number-test.toit:347:24: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:348:24: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
expect-equals 16 (int.parse "foo0x10bar" 3 7)
^~~~~~
tests/number-test.toit:348:25: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:349:25: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
expect-equals -16 (int.parse "foo-0x10bar" 3 8)
^~~~~~
tests/number-test.toit:351:24: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:352:24: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
expect-equals 16 (int.parse "foo0x10bar".to-byte-array 3 7)
^~~~~~
tests/number-test.toit:357:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:358:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-equals -1 (int.parse "foo0xbar" 3 5 --on-error=: -1)
^~~~~~
tests/number-test.toit:358:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:359:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-equals -1 (int.parse "foo0x7bar" 3 5 --on-error=: -1)
^~~~~~
tests/number-test.toit:359:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:360:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-equals -1 (int.parse "foo0x-7bar" 3 6 --on-error=: -1)
^~~~~~
tests/number-test.toit:363:24: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:364:24: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
expect-equals 16 (int.parse "foo0x10bar" 3 7)
^~~~~~
tests/number-test.toit:364:25: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:365:25: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
expect-equals -16 (int.parse "foo-0x10bar" 3 8)
^~~~~~
tests/number-test.toit:367:23: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
tests/number-test.toit:368:23: warning: Deprecated 'int.parse'. Use 'parse data --radix' with a slice instead
expect-equals 2 (int.parse "foo0b10bar".to-byte-array 3 7)
^~~~~~
tests/number-test.toit:372:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:373:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-equals -1 (int.parse "foo0bbar" 3 5 --on-error=: -1)
^~~~~~
tests/number-test.toit:373:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:374:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-equals -1 (int.parse "foo0b7bar" 3 5 --on-error=: -1)
^~~~~~
tests/number-test.toit:374:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
tests/number-test.toit:375:24: warning: Deprecated 'int.parse'. Use 'parse data --radix [--on-error]' with a slice instead
expect-equals -1 (int.parse "foo0b-7bar" 3 6 --on-error=: -1)
^~~~~~
10 changes: 5 additions & 5 deletions tests/number-test.toit
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,14 @@ test-float-stringify:
expect-equals (0x1_0000_0000 == 0x7fff_ffff_ffff_ffff) false

test-unsigned-stringify:
expect-equals "0" (0.stringify --unsigned-64)
expect-equals "1" (1.stringify --unsigned-64)
expect-equals "18446744073709551615" (-1.stringify --unsigned-64)
expect-equals "0" (0.stringify --uint64)
expect-equals "1" (1.stringify --uint64)
expect-equals "18446744073709551615" (-1.stringify --uint64)
biggest-signed := 9223372036854775807
next := biggest-signed + 1 // Wrap around.
expect next < 0
expect-equals "9223372036854775807" (9223372036854775807.stringify --unsigned-64)
expect-equals "9223372036854775808" (next.stringify --unsigned-64)
expect-equals "9223372036854775807" (9223372036854775807.stringify --uint64)
expect-equals "9223372036854775808" (next.stringify --uint64)

test-float-bin:
expect-equals 0 (0.0).bits
Expand Down

0 comments on commit 5864a6a

Please sign in to comment.