Repository navigation
Tier D: library-edge programs for utf8.codes/offset and math.fmod/ult/string.reverse (#61, #62) #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b91b365
Tier D: library-edge programs for utf8.codes/offset and math.fmod/ult…
InauguralPhysicist cc6397d
changes: one '- ' entry, as the fragment format requires
InauguralPhysicist dcc429a
Merge remote-tracking branch 'origin/main' into cloud-61
InauguralPhysicist e9a2835
LEDGER: count #55's MATCHing Tier D row (EigenLua#67, merged meanwhile)
InauguralPhysicist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 @@ | ||
| - Add differential corpus coverage for `utf8.codes`, `utf8.offset`, `math.fmod`, `math.ult`, and `string.reverse` edge cases (#61, #62). |
This file contains hidden or 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 hidden or 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,27 @@ | ||
| -- surface: math fmod signed zero-divisor and mixed operands, ult sign-boundary comparisons, and string reverse empty multibyte and NUL bytes | ||
| local function show(label, f, ...) | ||
| local r = table.pack(pcall(f, ...)) | ||
| io.write(label) | ||
| for i = 1, r.n do io.write("\t", tostring(r[i])) end | ||
| io.write("\n") | ||
| end | ||
|
|
||
| show("fmod -7 3", math.fmod, -7, 3) | ||
| show("fmod 7 -3", math.fmod, 7, -3) | ||
| show("fmod -7 -3", math.fmod, -7, -3) | ||
| show("fmod int zero", math.fmod, 7, 0) | ||
| show("fmod float zero", math.fmod, 7.0, 0.0) | ||
| show("fmod mixed float dividend", math.fmod, 7.5, 2) | ||
| show("fmod mixed float divisor", math.fmod, 7, 2.5) | ||
|
|
||
| show("ult negative positive", math.ult, -1, 1) | ||
| show("ult positive negative", math.ult, 1, -1) | ||
| show("ult min zero", math.ult, math.mininteger, 0) | ||
| show("ult zero min", math.ult, 0, math.mininteger) | ||
| show("ult max negative", math.ult, math.maxinteger, -1) | ||
| show("ult negative max", math.ult, -1, math.maxinteger) | ||
|
|
||
| print("reverse empty", string.reverse("") == "") | ||
| print("reverse multibyte", string.reverse("A\xc3\xa9\xe2\x82\xacZ")) | ||
| local nul = string.reverse("a\0bc") | ||
| print("reverse NUL", #nul, string.byte(nul, 1, -1)) |
This file contains hidden or 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,35 @@ | ||
| -- surface: utf8 codes strict and lax iteration, invalid sequences, and offset boundary and continuation-byte behavior | ||
| local function show(label, f, ...) | ||
| local r = table.pack(pcall(f, ...)) | ||
| io.write(label) | ||
| for i = 1, r.n do io.write("\t", tostring(r[i])) end | ||
| io.write("\n") | ||
| end | ||
|
|
||
| local function codes(s, lax) | ||
| local out = {} | ||
| for p, c in utf8.codes(s, lax) do | ||
| out[#out + 1] = p .. ":" .. c | ||
| end | ||
| return table.concat(out, ",") | ||
| end | ||
|
|
||
| local valid = "A\xc3\xa9\xe2\x82\xac\xf0\x9f\x98\x80Z" | ||
| show("codes valid", codes, valid) | ||
| show("codes continuation", codes, "A\x80B") | ||
| show("codes truncated", codes, "A\xe2\x82") | ||
| show("codes overlong strict", codes, "\xc0\x80") | ||
| show("codes out-of-range strict", codes, "\xf4\x90\x80\x80") | ||
| show("codes out-of-range lax", codes, "\xf4\x90\x80\x80", true) | ||
| show("codes extended lax", codes, "\xf8\x88\x80\x80\x80", true) | ||
|
|
||
| show("offset forward", utf8.offset, valid, 1, 1) | ||
| show("offset negative n", utf8.offset, valid, -1, #valid + 1) | ||
| show("offset zero lead", utf8.offset, valid, 0, 6) | ||
| show("offset zero continuation", utf8.offset, valid, 0, 7) | ||
| show("offset continuation start", utf8.offset, valid, 1, 3) | ||
| show("offset i zero", utf8.offset, valid, 1, 0) | ||
| show("offset i negative", utf8.offset, valid, 1, -1) | ||
| show("offset i past end", utf8.offset, valid, 1, #valid + 2) | ||
| show("offset n past end", utf8.offset, valid, 20, 1) | ||
| show("offset negative past start", utf8.offset, valid, -20, #valid + 1) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding these two programs increases Tier D from 157 to 159 files, but
tests/parse_all.sh:22still requires exactly 157. With the expected EigenScript executable available, the test now exits withHARNESS: population D=159 S=23, want 157 and 23before parsing any files. Update the population guard alongside these additions so the parser regression suite remains runnable.Useful? React with 👍 / 👎.