Skip to content

Commit

Permalink
validate with other snappy impls
Browse files Browse the repository at this point in the history
  • Loading branch information
guzba committed Nov 3, 2020
1 parent 3f7ebb6 commit 1aa5968
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
*.exe
*.js
nimcache
*.dll
14 changes: 11 additions & 3 deletions tests/test.nim
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ block baddata:
discard

const files = [
"alice29.txt", "asyoulik.txt", "fireworks.jpg", "geo.protodata",
"html", "html_x_4", "kppkn.gtb", "lcet10.txt", "paper-100k.pdf",
"plrabn12.txt", "urls.10K"
"alice29.txt",
"asyoulik.txt",
"fireworks.jpg",
"geo.protodata",
"html",
"html_x_4",
"kppkn.gtb",
"lcet10.txt",
"paper-100k.pdf",
"plrabn12.txt",
"urls.10K"
]

for file in files:
Expand Down
44 changes: 44 additions & 0 deletions tests/validate.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import strformat, supersnappy, snappy, nimsnappyc

const files = [
"alice29.txt",
"asyoulik.txt",
"fireworks.jpg",
"geo.protodata",
"html",
"html_x_4",
"kppkn.gtb",
"lcet10.txt",
"paper-100k.pdf",
"plrabn12.txt",
"urls.10K"
]

# import nimsnappy # Requires libsnappy.dll
# block dfdeshom_nimsnappy:
# echo "https://github.com/dfdeshom/nimsnappy"
# for file in files:
# let original = readFile(&"tests/data/{file}")
# doAssert nimsnappy.uncompress(supersnappy.compress(original)) == original
# doassert supersnappy.uncompress(nimsnappy.compress(original)) == original
# echo "pass!"

block nimcompression_nimsnappyc:
echo "https://github.com/NimCompression/nimsnappyc"
for file in files:
let original = cast[seq[uint8]](readFile(&"tests/data/{file}"))
doAssert nimsnappyc.snappyUncompress(
supersnappy.compress(original)
) == original
doassert supersnappy.uncompress(
nimsnappyc.snappyCompress(original)
) == original
echo "pass!"

block jangko_snappy:
echo "https://github.com/jangko/snappy"
for file in files:
let original = cast[seq[uint8]](readFile(&"tests/data/{file}"))
doAssert snappy.decode(supersnappy.compress(original)) == original
doassert supersnappy.uncompress(snappy.encode(original)) == original
echo "pass!"

0 comments on commit 1aa5968

Please sign in to comment.