diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2015-02-19 09:12:50 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2015-02-19 09:12:50 +0100 |
commit | 43c023c8ddaf5f6f4aee321fb042b5bdd8339fce (patch) | |
tree | 5bdc5e1e868cce8d436e4b810b04951149656fb4 /tests | |
parent | a8acb5ec65b5a3d6577602b9fc0d8832cf3a3287 (diff) | |
parent | a471b3c87fa3be6f9a5042ba8b814762118d4a07 (diff) | |
download | Nim-43c023c8ddaf5f6f4aee321fb042b5bdd8339fce.tar.gz |
Merge pull request #2164 from oderwat/fix-tohex
Fixing toHex() to not wrap for long lens + Test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stdlib/tstrutil.nim | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/tests/stdlib/tstrutil.nim b/tests/stdlib/tstrutil.nim index da65d1f89..ce9094bc0 100644 --- a/tests/stdlib/tstrutil.nim +++ b/tests/stdlib/tstrutil.nim @@ -2,18 +2,18 @@ discard """ file: "tstrutil.nim" output: "ha/home/a1xyz/usr/bin" """ -# test the new strutils module - -import - strutils - -proc testStrip() = - write(stdout, strip(" ha ")) - -proc main() = - testStrip() - for p in split("/home/a1:xyz:/usr/bin", {':'}): - write(stdout, p) +# test the new strutils module + +import + strutils + +proc testStrip() = + write(stdout, strip(" ha ")) + +proc main() = + testStrip() + for p in split("/home/a1:xyz:/usr/bin", {':'}): + write(stdout, p) proc testDelete = var s = "0123456789ABCDEFGH" @@ -25,25 +25,28 @@ proc testDelete = assert s == "1236789ABCDEFG" testDelete() - + assert(insertSep($1000_000) == "1_000_000") assert(insertSep($232) == "232") assert(insertSep($12345, ',') == "12,345") assert(insertSep($0) == "0") - -assert(editDistance("prefix__hallo_suffix", "prefix__hallo_suffix") == 0) -assert(editDistance("prefix__hallo_suffix", "prefix__hallo_suffi1") == 1) -assert(editDistance("prefix__hallo_suffix", "prefix__HALLO_suffix") == 5) -assert(editDistance("prefix__hallo_suffix", "prefix__ha_suffix") == 3) -assert(editDistance("prefix__hallo_suffix", "prefix") == 14) -assert(editDistance("prefix__hallo_suffix", "suffix") == 14) -assert(editDistance("prefix__hallo_suffix", "prefix__hao_suffix") == 2) + +assert(editDistance("prefix__hallo_suffix", "prefix__hallo_suffix") == 0) +assert(editDistance("prefix__hallo_suffix", "prefix__hallo_suffi1") == 1) +assert(editDistance("prefix__hallo_suffix", "prefix__HALLO_suffix") == 5) +assert(editDistance("prefix__hallo_suffix", "prefix__ha_suffix") == 3) +assert(editDistance("prefix__hallo_suffix", "prefix") == 14) +assert(editDistance("prefix__hallo_suffix", "suffix") == 14) +assert(editDistance("prefix__hallo_suffix", "prefix__hao_suffix") == 2) assert "/1/2/3".rfind('/') == 4 assert "/1/2/3".rfind('/', 1) == 0 assert "/1/2/3".rfind('0') == -1 - -main() -#OUT ha/home/a1xyz/usr/bin + +assert(toHex(100i16, 32) == "00000000000000000000000000000064") +assert(toHex(-100i16, 32) == "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9C") + +main() +#OUT ha/home/a1xyz/usr/bin |