Add rudimentary tests

This commit is contained in:
2023-06-22 17:24:35 +02:00
parent ea492c9ab9
commit bf23b2c175
6 changed files with 47 additions and 22 deletions

View File

@ -1,28 +1,33 @@
using metagraph_optimization
using MetagraphOptimization
using BenchmarkTools
using Base
using Base.Filesystem
function bench_txt(filepath::String)
function bench_txt(filepath::String, bench::Bool = true)
name = basename(filepath)
name, _ = splitext(name)
filepath = joinpath(@__DIR__, filepath)
println(name, ":")
g = import_txt(filepath)
print(g)
println(" Graph size in memory: ", bytes_to_human_readable(Base.summarysize(g)))
@btime import_txt($filepath)
println()
if (bench)
@btime import_txt($filepath)
println()
end
end
function main()
bench_txt("examples/AB->AB.txt")
bench_txt("examples/AB->ABBB.txt")
bench_txt("examples/AB->ABBBBB.txt")
bench_txt("examples/AB->ABBBBBBB.txt")
#bench_txt("examples/AB->ABBBBBBBBB.txt")
bench_txt("examples/ABAB->ABAB.txt")
bench_txt("examples/ABAB->ABC.txt")
function import_bench()
bench_txt("AB->AB.txt")
bench_txt("AB->ABBB.txt")
bench_txt("AB->ABBBBB.txt")
bench_txt("AB->ABBBBBBB.txt")
bench_txt("AB->ABBBBBBBBB.txt", false)
bench_txt("ABAB->ABAB.txt")
bench_txt("ABAB->ABC.txt")
end
main()
import_bench()