Skip to content

Commit

Permalink
Adapt Neo/Node unittests to actually instantiate node class
Browse files Browse the repository at this point in the history
This tests that all expected base class and interface methods are
implemented, not merely that the code is syntactically correct.
  • Loading branch information
Gavin Norman committed Aug 8, 2018
1 parent b472569 commit b102f1f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
20 changes: 19 additions & 1 deletion src/swarm/node/model/NeoNode.d
Original file line number Diff line number Diff line change
Expand Up @@ -1068,9 +1068,27 @@ version (UnitTest)
}
override protected void handleCommand () {}
}

private class TestNode : NodeBase!(TestConnectionHandler)
{
public this ( )
{
super(NodeItem("127.0.0.1".dup, 2323), new ConnectionSetupParams, 1);
}

protected override cstring id ( )
{
return "test";
}

protected override void getResourceAcquirer (
void delegate ( Object resource_acquirer ) handle_request_dg )
{
}
}
}

unittest
{
alias NodeBase!(TestConnectionHandler) Instance;
auto node = new TestNode;
}
15 changes: 14 additions & 1 deletion src/swarm/node/model/Node.d
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,22 @@ version (UnitTest)
}
override protected void handleCommand () {}
}

private class TestNode : NodeBase!(TestConnectionHandler)
{
public this ( )
{
super(NodeItem("127.0.0.1".dup, 2323), new ConnectionSetupParams, 1);
}

protected override cstring id ( )
{
return "test";
}
}
}

unittest
{
alias NodeBase!(TestConnectionHandler) Instance;
auto node = new TestNode;
}

0 comments on commit b102f1f

Please sign in to comment.