diff --git a/Project.toml b/Project.toml index 0fad4be..a4e74c8 100644 --- a/Project.toml +++ b/Project.toml @@ -21,6 +21,7 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" bsdiff_classic_jll = "7424abe3-9926-5da8-9b28-863d6330819c" bsdiff_endsley_jll = "4b92dbe6-3cad-5173-b451-9946eb17ce71" +zrl_jll = "9fe51eb0-a099-5680-98c2-fe494cf0c162" [targets] -test = ["Pkg", "Test", "bsdiff_classic_jll", "bsdiff_endsley_jll"] +test = ["Pkg", "Test", "bsdiff_classic_jll", "bsdiff_endsley_jll", "zrl_jll"] diff --git a/test/runtests.jl b/test/runtests.jl index 291ec39..7fb81a3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,6 +4,7 @@ using Pkg.Artifacts import bsdiff_classic_jll import bsdiff_endsley_jll +import zrl_jll const test_data = artifact"test_data" const FORMATS = sort!(collect(keys(BSDiff.FORMATS))) @@ -56,15 +57,36 @@ const FORMATS = sort!(collect(keys(BSDiff.FORMATS))) ref = joinpath(registry_data, "reference.diff") old_data = read(old) new_data = read(new) - @testset "hi-level API" for format in FORMATS + @testset "hi-level API (w/ timing)" for format in FORMATS + println("[ raw data ]") @show format index = bsindex(old) patch = @time bsdiff((old, index), new, format = format) patch = @time bsdiff((old, index), new, format = format) patch = @time bsdiff((old, index), new, format = format) new′ = bspatch(old, patch) + @test read(new) == read(new′) @show filesize(patch) end + @testset "ZRL data (w/timing)" for format in FORMATS + println("[ ZRL data ]") + @show format + old_zrl = tempname() + new_zrl = tempname() + zrl_jll.zrle() do zrle + run(pipeline(`$zrle $old`, old_zrl)) + run(pipeline(`$zrle $new`, new_zrl)) + end + index = bsindex(old_zrl) + patch = @time bsdiff((old_zrl, index), new_zrl, format = format) + patch = @time bsdiff((old_zrl, index), new_zrl, format = format) + patch = @time bsdiff((old_zrl, index), new_zrl, format = format) + new_zrl′ = bspatch(old_zrl, patch) + @test read(new_zrl) == read(new_zrl′) + @show filesize(patch) + rm(old_zrl) + rm(new_zrl) + end @testset "low-level API" begin # test that diff is identical to reference diff index = BSDiff.generate_index(old_data)