diff --git a/.gitattributes b/.gitattributes index 51833e5..39d6f86 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1 @@ -examples/AB->ABBBBB.txt filter=lfs diff=lfs merge=lfs -text -examples/AB->ABBBBBBB.txt filter=lfs diff=lfs merge=lfs -text -examples/ABAB->ABAB.txt filter=lfs diff=lfs merge=lfs -text -examples/ABAB->ABC.txt filter=lfs diff=lfs merge=lfs -text -examples/AB->AB.txt filter=lfs diff=lfs merge=lfs -text -examples/AB->ABBB.txt filter=lfs diff=lfs merge=lfs -text +examples/*.txt filter=lfs diff=lfs merge=lfs -text diff --git a/Project.toml b/Project.toml index ea1b7be..48119e0 100644 --- a/Project.toml +++ b/Project.toml @@ -1,4 +1,4 @@ -name = "metagraph_optimization" +name = "MetagraphOptimization" uuid = "3e869610-d48d-4942-ba70-c1b702a33ca4" authors = ["Anton Reinhard "] version = "0.1.0" @@ -9,3 +9,9 @@ DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] diff --git a/examples/import_bench.jl b/examples/import_bench.jl index 21b08fc..ef138c5 100644 --- a/examples/import_bench.jl +++ b/examples/import_bench.jl @@ -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() diff --git a/src/metagraph_optimization.jl b/src/MetagraphOptimization.jl similarity index 92% rename from src/metagraph_optimization.jl rename to src/MetagraphOptimization.jl index 32029db..d4617cd 100644 --- a/src/metagraph_optimization.jl +++ b/src/MetagraphOptimization.jl @@ -1,4 +1,4 @@ -module metagraph_optimization +module MetagraphOptimization import Base.show import Base.== import Base.in @@ -23,4 +23,4 @@ export ==, in, show export bytes_to_human_readable -end # module metagraph_optimization +end # module MetagraphOptimization diff --git a/test/known_graphs.jl b/test/known_graphs.jl new file mode 100644 index 0000000..0da46fb --- /dev/null +++ b/test/known_graphs.jl @@ -0,0 +1,13 @@ +using MetagraphOptimization +using Test + +function test_known_graphs() + + g_ABAB = import_txt(joinpath(@__DIR__, "..", "examples", "AB->AB.txt")) + props = graph_properties(g_ABAB) + + @test length(g_ABAB.nodes) == 34 + @test props.compute_effort == 185 + @test props.data == 102 + +end diff --git a/test/runtests.jl b/test/runtests.jl new file mode 100644 index 0000000..710ab86 --- /dev/null +++ b/test/runtests.jl @@ -0,0 +1,6 @@ +using MetagraphOptimization +using Test + +include("known_graphs.jl") + +test_known_graphs()