diff --git a/test/Project.toml b/test/Project.toml index a8cc30a..42dedd6 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,7 +1,9 @@ [deps] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" +GraphsInterfaceChecker = "3bef136c-15ff-4091-acbb-1a4aafe67608" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +LEMONGraphs = "14b1564f-c77f-4800-9e89-efd961faef7c" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" diff --git a/test/test_interface_checker.jl b/test/test_interface_checker.jl new file mode 100644 index 0000000..3434885 --- /dev/null +++ b/test/test_interface_checker.jl @@ -0,0 +1,38 @@ +using Test +using Graphs +using LEMONGraphs +using GraphsInterfaceChecker + +# helper: make a small usable LEMON graph +function make_small_undirected() + # Example: if your package exposes LEMONGraph(n) + g = LEMONGraph(5) + add_edge!(g, 1, 2) + add_edge!(g, 2, 3) + return g +end + +function make_small_directed() + gd = LEMONDiGraph(5) + add_edge!(gd, 1, 2) + add_edge!(gd, 2, 3) + return gd +end + +@testset "LEMONGraphs interface checks" begin + @testset "Undirected LEMONGraph" begin + g = make_small_undirected() + check_graph_interface(g) + if hasmethod(check_mutable_graph_interface, Tuple{typeof(g)}) + check_mutable_graph_interface(g) + end + end + + @testset "Directed LEMONGraph" begin + gd = make_small_directed() + check_digraph_interface(gd) + if hasmethod(check_mutable_graph_interface, Tuple{typeof(gd)}) + check_mutable_graph_interface(gd) + end + end +end