-
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.
Use string hash for comparing strings (#4)
Use string hash for comparing strings
- Loading branch information
Showing
5 changed files
with
129 additions
and
8 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,35 @@ | ||
\ Copyright 2019 nomennescio | ||
|
||
s" custom messages" describe#{ | ||
|
||
:noname ." Just passed" cr ; ^passed ! | ||
:noname ." Just failed" cr ; ^different ! | ||
|
||
s" short strings" it#{ | ||
<{ s" Hello World!" s# -> s" Hello World!" s# }> | ||
<{ s" Hello Worlds!" s# -> s" Hello Worlds!" s# }> | ||
}# | ||
s" failing compares" it#{ | ||
<{ s" Hello World!" s# -> s" Hello Worlds!" s# }> | ||
<{ s" Hello Worlds!" s# -> s" Hello Worlds! " s# }> | ||
}# | ||
|
||
2variable actual$ | ||
2variable expected$ | ||
|
||
:noname ." Got '" actual$ 2@ type ." ' as expected" cr ; ^passed ! | ||
:noname ." Expected '" expected$ 2@ type ." ', got '" actual$ 2@ type ." '" cr ; ^different ! | ||
|
||
: &actual 2dup actual$ 2! ; | ||
: &expected 2dup expected$ 2! ; | ||
|
||
s" short strings" it#{ | ||
<{ s" Hello World!" &actual s# -> s" Hello World!" &expected s# }> | ||
<{ s" Hello Worlds!" &actual s# -> s" Hello Worlds!" &expected s# }> | ||
}# | ||
s" failing compares" it#{ | ||
<{ s" Hello World!" &actual s# -> s" Hello Worlds!" &expected s# }> | ||
<{ s" Hello Worlds!" &actual s# -> s" Hello Worlds! " &expected s# }> | ||
}# | ||
|
||
}# |
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,36 @@ | ||
|
||
<DESCRIBE::>custom messages | ||
|
||
<IT::>short strings | ||
|
||
<PASSED::>Just passed | ||
|
||
<PASSED::>Just passed | ||
|
||
<COMPLETEDIN::>0.139 ms | ||
|
||
<IT::>failing compares | ||
|
||
<FAILED::>Just failed | ||
|
||
<FAILED::>Just failed | ||
|
||
<COMPLETEDIN::>0.162 ms | ||
|
||
<IT::>short strings | ||
|
||
<PASSED::>Got 'Hello World!' as expected | ||
|
||
<PASSED::>Got 'Hello Worlds!' as expected | ||
|
||
<COMPLETEDIN::>0.149 ms | ||
|
||
<IT::>failing compares | ||
|
||
<FAILED::>Expected 'Hello Worlds!', got 'Hello World!' | ||
|
||
<FAILED::>Expected 'Hello Worlds! ', got 'Hello Worlds!' | ||
|
||
<COMPLETEDIN::>0.150 ms | ||
|
||
<COMPLETEDIN::>1.365 ms |
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,11 @@ | ||
\ Copyright 2019 nomennescio | ||
s" string hash" describe#{ | ||
s" short strings" it#{ | ||
<{ s" Hello World!" s# -> s" Hello World!" s# }> | ||
<{ s" Hello Worlds!" s# -> s" Hello Worlds!" s# }> | ||
}# | ||
s" failing compares" it#{ | ||
<{ s" Hello World!" s# -> s" Hello Worlds!" s# }> | ||
<{ s" Hello Worlds!" s# -> s" Hello Worlds! " s# }> | ||
}# | ||
}# |
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,20 @@ | ||
|
||
<DESCRIBE::>string hash | ||
|
||
<IT::>short strings | ||
|
||
<PASSED::>Test Passed | ||
|
||
<PASSED::>Test Passed | ||
|
||
<COMPLETEDIN::>0.125 ms | ||
|
||
<IT::>failing compares | ||
|
||
<FAILED::>Expected 1266463317 , got 610024131 | ||
|
||
<FAILED::>Expected 1589968543 , got 1266463317 | ||
|
||
<COMPLETEDIN::>0.124 ms | ||
|
||
<COMPLETEDIN::>0.292 ms |
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