mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
decimal toStr maxInt and minInt tests
This commit is contained in:
parent
bc88fc3880
commit
b0a07558f1
1 changed files with 20 additions and 0 deletions
|
@ -913,6 +913,26 @@ test "toStr: 12345678912345678912.111111111111111111 (max number of digits)" {
|
|||
try expectEqualSlices(u8, res_slice, res_roc_str.?.asSlice());
|
||||
}
|
||||
|
||||
test "toStr: std.math.maxInt" {
|
||||
var dec: RocDec = .{ .num = std.math.maxInt(i128) };
|
||||
var res_roc_str = dec.toStr();
|
||||
errdefer res_roc_str.?.deinit();
|
||||
defer res_roc_str.?.deinit();
|
||||
|
||||
const res_slice: []const u8 = "170141183460469231731.687303715884105727"[0..];
|
||||
try expectEqualSlices(u8, res_slice, res_roc_str.?.asSlice());
|
||||
}
|
||||
|
||||
test "toStr: std.math.minInt" {
|
||||
var dec: RocDec = .{ .num = std.math.minInt(i128) };
|
||||
var res_roc_str = dec.toStr();
|
||||
errdefer res_roc_str.?.deinit();
|
||||
defer res_roc_str.?.deinit();
|
||||
|
||||
const res_slice: []const u8 = "-170141183460469231731.687303715884105728"[0..];
|
||||
try expectEqualSlices(u8, res_slice, res_roc_str.?.asSlice());
|
||||
}
|
||||
|
||||
test "toStr: 0" {
|
||||
var dec: RocDec = .{ .num = 0 };
|
||||
var res_roc_str = dec.toStr();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue