-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7546ae
commit e5367f2
Showing
9 changed files
with
142 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,4 @@ pub fn build_float_explicit_0_whole_test() { | |
) | ||
|> expect.to_equal(0.1) | ||
} | ||
// TODO: Built int tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import lenient_parse | ||
@target(javascript) | ||
import parse_error.{NotASafeInteger} | ||
import startest/expect | ||
|
||
const min_safe_integer = "-9007199254740991" | ||
|
||
const min_safe_integer_minus_one = "-9007199254740992" | ||
|
||
const max_safe_integer = "9007199254740991" | ||
|
||
const max_safe_integer_plus_one = "9007199254740992" | ||
|
||
@target(erlang) | ||
pub fn erlang_min_safe_integer_test() { | ||
min_safe_integer | ||
|> lenient_parse.to_int | ||
|> expect.to_equal(Ok(-9_007_199_254_740_991)) | ||
|
||
min_safe_integer_minus_one | ||
|> lenient_parse.to_int | ||
|> expect.to_equal(Ok(-9_007_199_254_740_992)) | ||
} | ||
|
||
@target(erlang) | ||
pub fn erlang_max_safe_integer_test() { | ||
max_safe_integer | ||
|> lenient_parse.to_int | ||
|> expect.to_equal(Ok(9_007_199_254_740_991)) | ||
|
||
max_safe_integer_plus_one | ||
|> lenient_parse.to_int | ||
|> expect.to_equal(Ok(9_007_199_254_740_992)) | ||
} | ||
|
||
@target(javascript) | ||
pub fn javascript_min_safe_integer_test() { | ||
min_safe_integer | ||
|> lenient_parse.to_int | ||
|> expect.to_equal(Ok(-9_007_199_254_740_991)) | ||
|
||
min_safe_integer_minus_one | ||
|> lenient_parse.to_int | ||
|> expect.to_equal(Error(NotASafeInteger(min_safe_integer_minus_one))) | ||
} | ||
|
||
@target(javascript) | ||
pub fn javascript_max_safe_integer_test() { | ||
max_safe_integer | ||
|> lenient_parse.to_int | ||
|> expect.to_equal(Ok(9_007_199_254_740_991)) | ||
|
||
max_safe_integer_plus_one | ||
|> lenient_parse.to_int | ||
|> expect.to_equal(Error(NotASafeInteger(max_safe_integer_plus_one))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters