diff --git a/docs/make.jl b/docs/make.jl index 142681d..578cdb5 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -16,6 +16,7 @@ makedocs( "index.md", "Manual" => "manual.md", "Library" => [ + "Public" => "lib/public.md", "Graph" => "lib/internals/graph.md", "Node" => "lib/internals/node.md", "Task" => "lib/internals/task.md", diff --git a/src/MetagraphOptimization.jl b/src/MetagraphOptimization.jl index 6188bfd..1e8c0c9 100644 --- a/src/MetagraphOptimization.jl +++ b/src/MetagraphOptimization.jl @@ -15,6 +15,8 @@ export AbstractComputeTask export AbstractDataTask export DataTask export FusedComputeTask +export PossibleOperations +export GraphProperties export make_node export make_edge diff --git a/src/properties/utility.jl b/src/properties/utility.jl index 6f2220e..bf936db 100644 --- a/src/properties/utility.jl +++ b/src/properties/utility.jl @@ -52,6 +52,7 @@ function -(prop::GraphProperties) data = -prop.data, computeEffort = -prop.computeEffort, computeIntensity = prop.computeIntensity, # no negation here! + cost = -prop.cost, noNodes = -prop.noNodes, noEdges = -prop.noEdges, )::GraphProperties diff --git a/test/runtests.jl b/test/runtests.jl index 74f7f81..2ea1a76 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,6 +5,7 @@ using Test include("unit_tests_utility.jl") include("unit_tests_tasks.jl") include("unit_tests_nodes.jl") + include("unit_tests_properties.jl") include("node_reduction.jl") include("unit_tests_graph.jl") diff --git a/test/unit_tests_properties.jl b/test/unit_tests_properties.jl new file mode 100644 index 0000000..97a53ad --- /dev/null +++ b/test/unit_tests_properties.jl @@ -0,0 +1,52 @@ + +@testset "GraphProperties Unit Tests" begin + prop = GraphProperties() + + @test prop.data == 0.0 + @test prop.computeEffort == 0.0 + @test prop.computeIntensity == 0.0 + @test prop.cost == 0.0 + @test prop.noNodes == 0.0 + @test prop.noEdges == 0.0 + + prop2 = ( + data = 5.0, + computeEffort = 6.0, + computeIntensity = 6.0 / 5.0, + cost = 0.0, + noNodes = 2, + noEdges = 3, + )::GraphProperties + + @test prop + prop2 == prop2 + @test prop2 - prop == prop2 + + negProp = -prop2 + @test negProp.data == -5.0 + @test negProp.computeEffort == -6.0 + @test negProp.computeIntensity == 6.0 / 5.0 + @test negProp.cost == 0.0 + @test negProp.noNodes == -2 + @test negProp.noEdges == -3 + + @test negProp + prop2 == GraphProperties() + + prop3 = ( + data = 7.0, + computeEffort = 3.0, + computeIntensity = 7.0 / 3.0, + cost = 0.0, + noNodes = -3, + noEdges = 2, + )::GraphProperties + + propSum = prop2 + prop3 + + @test propSum.data == 12.0 + @test propSum.computeEffort == 9.0 + @test propSum.computeIntensity == 9.0 / 12.0 + @test propSum.cost == 0.0 + @test propSum.noNodes == -1 + @test propSum.noEdges == 5 +end +println("GraphProperties Unit Tests Complete!")