Skip to content

Commit

Permalink
use TestsForCodecPackages.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed Aug 2, 2024
1 parent 107ccae commit ecd83cd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
9 changes: 1 addition & 8 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "CodecZlib"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
license = "MIT"
authors = ["Kenta Sato <[email protected]>"]
version = "0.7.5"
version = "0.7.6"

[deps]
TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
Expand All @@ -11,10 +11,3 @@ Zlib_jll = "83775a58-1f1d-513f-b197-d71354ab007a"
[compat]
TranscodingStreams = "0.9, 0.10, 0.11"
julia = "1.3"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[targets]
test = ["Test", "Random"]
5 changes: 5 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestsForCodecPackages = "c2e61002-3542-480d-8b3c-5f05cc4f8554"
TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
30 changes: 14 additions & 16 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
using CodecZlib
using Random
using Test
import TranscodingStreams:
using TranscodingStreams:
TranscodingStreams,
TranscodingStream,
TranscodingStream
using TestsForCodecPackages:
test_roundtrip_read,
test_roundtrip_write,
test_roundtrip_transcode,
test_roundtrip_lines,
test_roundtrip_transcode
test_roundtrip_seekstart,
test_roundtrip_fileio,
test_chunked_read,
test_chunked_write

const testdir = @__DIR__

Expand Down Expand Up @@ -106,9 +110,7 @@ const testdir = @__DIR__
test_roundtrip_read(GzipCompressorStream, GzipDecompressorStream)
test_roundtrip_write(GzipCompressorStream, GzipDecompressorStream)
test_roundtrip_lines(GzipCompressorStream, GzipDecompressorStream)
if isdefined(TranscodingStreams, :test_roundtrip_seekstart)
TranscodingStreams.test_roundtrip_seekstart(GzipCompressorStream, GzipDecompressorStream)
end
test_roundtrip_seekstart(GzipCompressorStream, GzipDecompressorStream)
test_roundtrip_transcode(GzipCompressor, GzipDecompressor)

@test_throws ArgumentError GzipCompressor(level=10)
Expand Down Expand Up @@ -189,9 +191,7 @@ end
test_roundtrip_read(ZlibCompressorStream, ZlibDecompressorStream)
test_roundtrip_write(ZlibCompressorStream, ZlibDecompressorStream)
test_roundtrip_lines(ZlibCompressorStream, ZlibDecompressorStream)
if isdefined(TranscodingStreams, :test_roundtrip_seekstart)
TranscodingStreams.test_roundtrip_seekstart(ZlibCompressorStream, ZlibDecompressorStream)
end
test_roundtrip_seekstart(ZlibCompressorStream, ZlibDecompressorStream)
test_roundtrip_transcode(ZlibCompressor, ZlibDecompressor)

@test_throws ArgumentError ZlibCompressor(level=10)
Expand All @@ -216,9 +216,7 @@ end
test_roundtrip_read(DeflateCompressorStream, DeflateDecompressorStream)
test_roundtrip_write(DeflateCompressorStream, DeflateDecompressorStream)
test_roundtrip_lines(DeflateCompressorStream, DeflateDecompressorStream)
if isdefined(TranscodingStreams, :test_roundtrip_seekstart)
TranscodingStreams.test_roundtrip_seekstart(DeflateCompressorStream, DeflateDecompressorStream)
end
test_roundtrip_seekstart(DeflateCompressorStream, DeflateDecompressorStream)
test_roundtrip_transcode(DeflateCompressor, DeflateDecompressor)

@test DeflateCompressorStream <: TranscodingStream
Expand All @@ -231,9 +229,9 @@ end

# Test APIs of TranscodingStreams.jl using the gzip compressor/decompressor.
@testset "TranscodingStreams" begin
TranscodingStreams.test_chunked_read(GzipCompressor, GzipDecompressor)
TranscodingStreams.test_chunked_write(GzipCompressor, GzipDecompressor)
TranscodingStreams.test_roundtrip_fileio(GzipCompressor, GzipDecompressor)
test_chunked_read(GzipCompressor, GzipDecompressor)
test_chunked_write(GzipCompressor, GzipDecompressor)
test_roundtrip_fileio(GzipCompressor, GzipDecompressor)

@testset "seek" begin
data = transcode(GzipCompressor, Vector(b"abracadabra"))
Expand Down

0 comments on commit ecd83cd

Please sign in to comment.