Added test foir i/o

This commit is contained in:
Alberto Ramos 2022-06-04 23:20:55 +02:00
parent 2e71d6c0e1
commit 178a58d586

37
test/io/test_io.jl Normal file
View file

@ -0,0 +1,37 @@
###
### "THE BEER-WARE LICENSE":
### Alberto Ramos wrote this file. As long as you retain this
### notice you can do whatever you want with this stuff. If we meet some
### day, and you think this stuff is worth it, you can buy me a beer in
### return. <alberto.ramos@cern.ch>
###
### file: test_io.jl
### created: Thu Jun 2 18:20:42 2022
###
using LatticeGPU, Test
T = Float64
lp = SpaceParm{4}((16,16,16,16), (4,4,4,4), BC_PERIODIC, (0,0,0,0,0,0))
gp = GaugeParm{T}(SU3{T}, 6.1, 1.0)
ymws = YMworkspace(SU3, T, lp)
randomize!(ymws.mom, lp, ymws)
U = exp.(ymws.mom)
pl1 = plaquette(U, lp, gp, ymws)
cl1 = Eoft_clover(U, gp, lp, ymws)
fn = "foo.bdio"
rm(fn, force=true)
save_cnfg(fn, U, lp, gp; run="Dumnmy_run")
Ucp = read_cnfg(fn)
pl2 = plaquette(Ucp, lp, gp, ymws)
cl2 = Eoft_clover(Ucp, gp, lp, ymws)
rm(fn, force=true)
@testset "Testing configuration i/o" begin
@test isapprox(pl1,pl2)
@test isapprox(cl1,cl2)
end