Add tests
This commit is contained in:
parent
7387fa86b1
commit
e09ab7c77b
@ -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",
|
||||
|
@ -15,6 +15,8 @@ export AbstractComputeTask
|
||||
export AbstractDataTask
|
||||
export DataTask
|
||||
export FusedComputeTask
|
||||
export PossibleOperations
|
||||
export GraphProperties
|
||||
|
||||
export make_node
|
||||
export make_edge
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
||||
|
52
test/unit_tests_properties.jl
Normal file
52
test/unit_tests_properties.jl
Normal file
@ -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!")
|
Loading…
x
Reference in New Issue
Block a user