Skip to content

Commit

Permalink
use zrl_jll to time diffing zero run-length encoded data (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski authored Mar 27, 2020
1 parent 513aff7 commit 87426f9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
24 changes: 23 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 87426f9

Please sign in to comment.