Repository navigation
test: add unit tests for Curl_range - #23236
ElGitMan74 wants to merge 1 commit into
Conversation
|
Analysis of PR #23236 at f3f2a357: Test 1700 failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 4 different CI jobs (the link just goes to one of them). Generated by Testclutch |
|
Isn't this function tested indirectly via FTP/FILE tests? |
|
Hello @vszakats , we have an opportunity for a direct Curl_range test with this unit test. I didn't see this level of range or boundary exercise in the existing unit tests. |
It may be because it's already tested indirectly. I'm not personally convinced |
|
The LLM found the lack of unit testing for this item. the unit test itself
is from me, following the patterns of other existing unit tests.
…On Fri, Oct 2, 2026 at 12:22 PM Viktor Szakats ***@***.***> wrote:
*vszakats* left a comment (curl/curl#23236)
<#23236 (comment)>
Hello @vszakats <https://github.com/vszakats> , we have an opportunity
for a direct Curl_range test with this unit test. I didn't see this level
of range or boundary exercise in the existing unit tests.
It may be because it's already tested indirectly. I'm not personally
convinced
this is code and machine time the best spent. It seems like something an
LLM
would generate.
—
Reply to this email directly, view it on GitHub
<#23236?email_source=notifications&email_token=BSK26NJFOWFESUDFKFGY6WL5R7I35A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOJVGY2TMNZVGI42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5956567529>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BSK26NKTJLCYP3ODIJ6LR635R7I35AVCNFSNUABCKJSXA33TNF2G64TZHM2TMOJQGQYTWSLTON2WKOZVGY3TQOJRGM3TINNBOYBA>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/BSK26NNY4SFLFHVZ7OG3XGL5R7I35A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOJVGY2TMNZVGI42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/BSK26NPK6QS5GEJVZ3YI6R35R7I35A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOJVGY2TMNZVGI42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Why did you replace test 1700 which is unrelated? I agree with Viktor there's hints of an LLM here. We have range testing already tests 1016-1020 test1063, probably others, though yours may have better coverage in one place. I think what we have now is ok? For now I'll leave this open for more feedback. |
|
Hello @jay , there was no existing 1700, that number was skipped |
https://github.com/curl/curl/blob/master/tests/data/test1700 |
I sit corrected. I'll move the code to a new number. |
4bb8edc to
b118645
Compare
That's my issue; an LLM will point out any internal function without a dedicated |
Ok, test moved to an unused number unit1694. Appreciate your patience, code is ready for your review. One github check failed on timeout, passed previously. If you guys decide to reject this PR because an LLM pointed me to an area that didn't have it's own unit test, how would you suggest I find an area to help with the unit testing? I want to help here. |
|
I think a unit test for this makes sense. But I think it should be written in a way so that we can have list of ranges, and the test case should iterate over those and test them. Not copy-and-paste all the logic for the few tests done. I think many other existing unit tests can serve as inspiration for that. Then we can extend the set to make sure we test all reasonable variations, including all edge cases and wrong ones. |
Hello @bagder and thanks for your response. I love that idea! Very clean implementation. It looks like unit1307 has an appropriate pattern for testing multiple sets of input values: https://github.com/curl/curl/blob/master/tests/unit/unit1307.c I'm traveling this week so I won't be able to pick this up again until next week. I can close this PR to get it out of your way while I'm out, or I can reuse this PR starting next week. Up to you guys whatever keeps your queue cleaned up. Again, thank you all for your time and patience. |
520e0a5 to
ad7d8db
Compare
|
Greetings @vszakats , thank you for your comments, I have incorporated them all. One CI/CD test is timing out that passed previously. Please let me know if I need to do anything further to move this PR forward, thanks. |
dfc9c8b to
2e38a64
Compare
| /* Start at the beginning, go to a byte */ | ||
| { TRUE, "-100", CURLE_OK, -100, 100 }, | ||
| /* A range of bytes */ | ||
| { TRUE, "100-201", CURLE_OK, 100, 102 } |
There was a problem hiding this comment.
I think this can test many more variants:
- ranges that use numbers with (many) zero prefixes to the number
- ranges that end of the largest possible (2^63-1) number
- ranges that use hexadecimal numbers
- ranges that use more spaces sprinkled "- 100", "1 - 100", "1 - 200" etc
- ranges that have a tab in the string "0 -\x09 100"
- negative to positive "-100 - 200"
- negative to negative "-100 - -200"
- ranges that use + for the number "+100 - +200"
There was a problem hiding this comment.
Same number to number: "100 - 100"
There was a problem hiding this comment.
Hello @bagder and thanks for your suggestions! Lots of new tests added and git committed. I added comments around some of the tests explaining their weird behavior, we fed the parser some stuff it's wasn't used to! Not enough to core dump it ;-) A few of the commit tests are timing out again. Let me know if you have further suggestions or feedback, your time is much appreciated.
d59b8c0 to
4b3bae2
Compare
|
"Merge conflicts", please fix and force-push |
Add unit1694 covering Curl_range() with a table of valid and invalid range strings: the no-op cases, the parse errors, and the N-, -N and N-M forms.
1958332 to
4a395b4
Compare
Thanks @bagder , I rebased on current master and force-pushed as a single commit; the conflicts are resolved. |
|
Thanks, merged! |
unit1700: test all Curl_range paths and all boundary conditions
Summary by CodeRabbit