Commit 5d6b2f9d authored by Alberto Ramos's avatar Alberto Ramos

Added second test

parent 720170b1
......@@ -6,3 +6,6 @@ using Test
println("Test [test1.jl]")
@time @test include("test1.jl")
println("Test [test2.jl]")
@time @test include("test2.jl")
BDIO_set_user("alberto")
BDIO_set_host("laptop")
fb = BDIO_open("foo.bdio", "w", "Test file")
BDIO_start_record!(fb, BDIO_BIN_INT64LE, 1, true)
BDIO_write!(fb, collect(1:1000))
BDIO_write_hash!(fb)
BDIO_start_record!(fb, BDIO_BIN_F64LE, 2, true)
vec1 = randn(1000)
vec2 = similar(vec1)
vec2 .= .- vec1
BDIO_write!(fb, vec1)
BDIO_write!(fb, vec2)
BDIO_write_hash!(fb)
BDIO_close!(fb)
fb2 = BDIO_open("foo.bdio", "r")
let isum::Int64 = 0, fsum::Float64 = 0.0
while BDIO_seek!(fb2)
if BDIO_get_uinfo(fb2) == 1
idt = similar(Array{Int64, 1}, 100)
for i = 1:10
BDIO_read(fb2, idt)
isum += sum(idt)
end
elseif BDIO_get_uinfo(fb2) == 2
fdt = similar(Array{Float64, 1}, 100)
for i = 1:20
BDIO_read(fb2, fdt)
fsum += sum(fdt)
end
end
end
end
rm("foo.bdio", force=true)
( (abs(fsum) < 1.0E-10) && ((2*isum - 1000*(1001)) == 0) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment