Commit 81b11657 authored by Alberto Ramos's avatar Alberto Ramos

Added tests

parent ed653c27
#/usr/bin/env julia11
# Start test script
using BDIO
using Test
println("Test [test1.jl]")
@time @test include("test1.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")
global isum = 0
global fsum = 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)
global isum += sum(idt)
end
elseif BDIO_get_uinfo(fb2) == 2
fdt = similar(Array{Float64, 1}, 100)
for i = 1:20
BDIO_read(fb2, fdt)
global fsum += sum(fdt)
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