commit
66d13402c1
|
@ -80,18 +80,18 @@ install:
|
|||
)
|
||||
|
||||
- git clone --depth 1 https://github.com/google/snappy
|
||||
|
||||
|
||||
build_script:
|
||||
- cd snappy
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake .. -G "MinGW Makefiles"
|
||||
- cmake .. -G "MinGW Makefiles" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin"
|
||||
- mingw32-make
|
||||
- copy libsnappy.a C:\projects\%APPVEYOR_PROJECT_SLUG%\tests
|
||||
|
||||
- copy libsnappy.a C:\projects\snappy\tests
|
||||
|
||||
- cd C:\projects\%APPVEYOR_PROJECT_SLUG%
|
||||
- nimble install -y > nul
|
||||
|
||||
|
||||
test_script:
|
||||
- nimble test
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ script:
|
|||
- mkdir build
|
||||
- cd build && cmake ../ && make
|
||||
- cd ../..
|
||||
- cp snappy/build/libsnappy.a tests/libsnappy.a
|
||||
- cp snappy/build/libsnappy.a ./tests/
|
||||
|
||||
- nimble install -y > /dev/null
|
||||
- nimble test
|
||||
|
|
|
@ -8,5 +8,5 @@ skipDirs = @["tests"]
|
|||
requires: "nim >= 0.19.0"
|
||||
|
||||
task test, "Run all tests":
|
||||
exec "nim c tests/test"
|
||||
exec "nim c -d:release tests/test"
|
||||
exec "nim c --passL:\"-lsnappy -L./tests -lstdc++\" -r tests/test"
|
||||
exec "nim c --passL:\"-lsnappy -L./tests -lstdc++\" -d:release -r tests/test"
|
||||
|
|
|
@ -2,10 +2,6 @@ import
|
|||
snappy, os, unittest,
|
||||
terminal, strutils, randgen
|
||||
|
||||
{.passL: "-lsnappy".}
|
||||
{.passL: "-L.".}
|
||||
{.passL: "-lstdc++".}
|
||||
|
||||
proc snappy_compress(input: cstring, input_length: csize, compressed: cstring, compressed_length: var csize): cint {.importc, cdecl.}
|
||||
proc snappy_uncompress(compressed: cstring, compressed_length: csize, uncompressed: cstring, uncompressed_length: var csize): cint {.importc, cdecl.}
|
||||
proc snappy_max_compressed_length(source_length: csize): csize {.importc, cdecl.}
|
||||
|
@ -100,22 +96,23 @@ template toBytes(s: string): auto =
|
|||
toOpenArrayByte(s, 0, s.len-1)
|
||||
|
||||
suite "snappy":
|
||||
let dataDir = getAppDir() & DirSep & testDataDir
|
||||
test "basic roundtrip test":
|
||||
check roundTrip("empty", empty)
|
||||
check roundTrip("oneZero", oneZero)
|
||||
check roundTrip("data_html", testDataDir & "html")
|
||||
check roundTrip("data_urls", testDataDir & "urls.10K")
|
||||
check roundTrip("data_jpg", testDataDir & "fireworks.jpeg")
|
||||
check roundTrip("data_pdf", testDataDir & "paper-100k.pdf")
|
||||
check roundTrip("data_html4", testDataDir & "html_x_4")
|
||||
check roundTrip("data_txt1", testDataDir & "alice29.txt")
|
||||
check roundTrip("data_txt2", testDataDir & "asyoulik.txt")
|
||||
check roundTrip("data_txt3", testDataDir & "lcet10.txt")
|
||||
check roundTrip("data_txt4", testDataDir & "plrabn12.txt")
|
||||
check roundTrip("data_pb", testDataDir & "geo.protodata")
|
||||
check roundTrip("data_gaviota", testDataDir & "kppkn.gtb")
|
||||
check roundTrip("data_golden", testDataDir & "Mark.Twain-Tom.Sawyer.txt")
|
||||
check roundTripRev("data_golden_rev", testDataDir & "Mark.Twain-Tom.Sawyer.txt.rawsnappy")
|
||||
check roundTrip("data_html", dataDir & "html")
|
||||
check roundTrip("data_urls", dataDir & "urls.10K")
|
||||
check roundTrip("data_jpg", dataDir & "fireworks.jpeg")
|
||||
check roundTrip("data_pdf", dataDir & "paper-100k.pdf")
|
||||
check roundTrip("data_html4", dataDir & "html_x_4")
|
||||
check roundTrip("data_txt1", dataDir & "alice29.txt")
|
||||
check roundTrip("data_txt2", dataDir & "asyoulik.txt")
|
||||
check roundTrip("data_txt3", dataDir & "lcet10.txt")
|
||||
check roundTrip("data_txt4", dataDir & "plrabn12.txt")
|
||||
check roundTrip("data_pb", dataDir & "geo.protodata")
|
||||
check roundTrip("data_gaviota", dataDir & "kppkn.gtb")
|
||||
check roundTrip("data_golden", dataDir & "Mark.Twain-Tom.Sawyer.txt")
|
||||
check roundTripRev("data_golden_rev", dataDir & "Mark.Twain-Tom.Sawyer.txt.rawsnappy")
|
||||
|
||||
test "misc test":
|
||||
for i in 1..32:
|
||||
|
|
Loading…
Reference in New Issue