Skip to content

Commit

Permalink
remove counter and data from test structs
Browse files Browse the repository at this point in the history
  • Loading branch information
guyvdbroeck committed Mar 29, 2021
1 parent 7d89363 commit ccdd504
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
5 changes: 1 addition & 4 deletions src/Utils/graphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ struct Inner <: NodeType end
# basic fields and methods
#####################

# Each `Node` is required to have fields
# - `counter::UInt32`
# - `data:Any`
# and a specialized method for the following functions.
# Each `Node` is required to provide a specialized method for the following functions.

"Get the node type trait of the given `Node`"
@inline NodeType(node::Node) = NodeType(typeof(node))
Expand Down
14 changes: 2 additions & 12 deletions test/Utils/graphs_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ module TestNodes
mutable struct TestINode <: Dag
id::Int
children::Vector{Dag}
data
counter::UInt32
TestINode(i,c) = new(i,c,nothing,false)
TestINode(i,c) = new(i,c)
end

mutable struct TestLNode <: Dag
id::Int
data
counter::UInt32
TestLNode(i) = new(i,nothing,false)
TestLNode(i) = new(i)
end

LogicCircuits.NodeType(::Type{<:TestINode}) = Inner()
Expand Down Expand Up @@ -62,19 +58,13 @@ module TestNodes
@test i12.id == 4
@test j2.id == 3
@test r.id == 6
@test r.counter == 0
@test l1.counter == 0
@test i12.counter == 0

foreach(r, l -> l.id += 1, i -> i.id -= 1)
@test l1.id == 2+1
@test l2.id == 3+1
@test i12.id == 4-1
@test j2.id == 3-1
@test r.id == 6-1
@test r.counter == 0
@test l1.counter == 0
@test i12.counter == 0

@test filter(n -> iseven(n.id), r) == [l2,i2,j2]

Expand Down

0 comments on commit ccdd504

Please sign in to comment.