-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from nbuilding/SheepTester-patch-1
Add a few more tests for floats and strings
- Loading branch information
Showing
3 changed files
with
59 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// No equivalent in the documentation 😳 | ||
|
||
// Floats are double-precision :postpissedchil: | ||
|
||
// Division of nonzero numbers by zero; negative zero | ||
let inf = 1.0 / 0.0 | ||
assert value 1.0 / -0.0 == -inf | ||
assert value 0.0 == -0.0 | ||
|
||
// NaN | ||
let nan = inf - inf | ||
assert value nan /= nan | ||
assert value 0.0 / 0.0 /= 0.0 / 0.0 | ||
|
||
assert value 0.1 + 0.2 == 0.30000000000000004 | ||
|
||
assert value 9007199254740992.0 + 1.0 == 9007199254740992.0 | ||
|
||
// Strings | ||
|
||
assert value "\{🕴}" == "🕴" | ||
assert value "\0\b\t\n\v\f\r\"\\" == "\u{0}\u{8}\u{9}\u{a}\u{b}\u{c}\u{d}\u{22}\u{5c}" | ||
|
||
// Chars | ||
|
||
assert value \v == \u{b} |
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 |
---|---|---|
@@ -1,9 +1,20 @@ | ||
// Based on docs/features/tuples_lists_records.md | ||
|
||
assert type 1, \{a} : int, char | ||
let tuplevalue = 1, \{a} | ||
assert type tuplevalue : int, char | ||
|
||
let recordValue = { value: 1 } | ||
assert type recordValue : { value: int } | ||
assert type recordValue.value : int | ||
|
||
assert type ["a", "b", "c"] : list[str] | ||
let value = recordvalue.value | ||
assert type value : int | ||
assert value value == 1 | ||
|
||
let listvalue = ["a", "b", "c"] | ||
assert type listvalue : list[str] | ||
|
||
assert value append("d", listvalue) == ["a", "b", "c", "d"] | ||
assert value listvalue == ["a", "b", "c"] | ||
|
||
let listindexvalue = itemAt(1, listvalue) | ||
assert value listindexvalue == yes("b") |
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,19 @@ | ||
// Number and string literal syntax to ensure they're supported | ||
|
||
let binary = 0b10101 | ||
let octal = 0o70707 | ||
let hex = 0x123AbC | ||
|
||
// TODO: Do we allow something like `50e10`? | ||
let scinot = -5.000000000000001e-231 | ||
|
||
let newline = \n | ||
let char = \{🐑} | ||
let unicode = \u{1f382} | ||
|
||
let allTogether = "\n\{🐑}\u{1f382}\\\\\\\\" | ||
|
||
let unit = () | ||
|
||
let trailingComma = { a: (1, 2,); b: 2; } | ||
let inList: map[str, str,] = mapFrom([("ah", "pple",), ("ahh", "ppple",),],) |