hashes: fix inconsistent tests, fixes #10771
This commit is contained in:
parent
d6882691ad
commit
792dfac521
1 changed files with 3 additions and 4 deletions
|
|
@ -143,8 +143,7 @@ proc hash*(x: string): Hash =
|
||||||
## * `hashIgnoreStyle <#hashIgnoreStyle,string>`_
|
## * `hashIgnoreStyle <#hashIgnoreStyle,string>`_
|
||||||
## * `hashIgnoreCase <#hashIgnoreCase,string>`_
|
## * `hashIgnoreCase <#hashIgnoreCase,string>`_
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
doAssert hash("abracadabra") == -5600162842546114722
|
doAssert hash("abracadabra") != hash("AbracadabrA")
|
||||||
doAssert hash("Abracadabra") == 2068684413884279454
|
|
||||||
|
|
||||||
var h: Hash = 0
|
var h: Hash = 0
|
||||||
for i in 0..x.len-1:
|
for i in 0..x.len-1:
|
||||||
|
|
@ -154,8 +153,8 @@ proc hash*(x: string): Hash =
|
||||||
proc hash*(x: cstring): Hash =
|
proc hash*(x: cstring): Hash =
|
||||||
## Efficient hashing of null-terminated strings.
|
## Efficient hashing of null-terminated strings.
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
doAssert hash(cstring"abracadabra") == -5600162842546114722
|
doAssert hash(cstring"abracadabra") == hash("abracadabra")
|
||||||
doAssert hash(cstring"Abracadabra") == 2068684413884279454
|
doAssert hash(cstring"AbracadabrA") == hash("AbracadabrA")
|
||||||
|
|
||||||
var h: Hash = 0
|
var h: Hash = 0
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue