-
Notifications
You must be signed in to change notification settings - Fork 53
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
Fix tests to be string hash order independent #551
Conversation
hash order issue allowing nim-core to change its string hash function without making this test fail.
I haven't explored the reported error in detail, but it looks like it might be a missing |
|
not allowing definition of a comparison before such tests.
Another compile error, another Needless to say, I am not running these tests locally (I am not set up to). Much appreciated if you could approve the workflow again. |
like a compiler bug to report if it isn't already { but that's also a behavior for a more isolated test just sorting one of the `seq` }.
Ok. Naming fields with This time I at least confirmed compilation & functioning locally of import std/algorithm
proc `<`(a, b: (string,string)): bool = a[0] < b[0]
echo @[("Header2", "value2"), ("Header2", "VALUE3"), ("Header1", "value1")].sorted So, I have high hopes this version will work. Thanks for approving the workflow yet again! |
Ack. I just kept mis-reading compiler errors. This works for me locally and should work now if you approve the workflow yet again (famous last words, as they say!): import std/[algorithm, assertions]
proc `<`(a, b: (string, seq[string])): bool = a[0] < b[0]
let data1 = @[("Header2", "value2"), ("Header2", "VALUE3"), ("Header1", "value1")]
let data2 = @[("Header2", @["value2", "VALUE3"]), ("Header1", @["value1"])]
assert data1.sorted == sorted(@[("Header2", "value2"), ("Header2", "VALUE3"),
("Header1", "value1")])
assert data2.sorted == sorted(@[("Header2", @["value2", "VALUE3"]),
("Header1", @["value1"])]) |
Heh, we're back at |
I don't know what's wrong now. That above snippet really does run fine locally on nim-devel. I could add a |
but try to satisfy its needs with length-based definition.
a note about tending to it if more `seq[]` are ever sorted.
ref status-im/nim-chronos#551 which is in an uncertain state
Well, with yesterday's final commit (lifting There may be other considerations in tagging a new Chronos release so as to pass the main Nim CI, but as far as this test failure is concerned, I think the work is done and this PR is ok to merge. Let me know if this is not the case. Thanks |
For new Farm Hash-based hash(x:string).