Skip to content

Commit

Permalink
Graph
Browse files Browse the repository at this point in the history
- Implemented `getValue()`

Graph (unittests)

- Added tests for `getValue()`
  • Loading branch information
deavmi committed May 4, 2024
1 parent 9610689 commit 1ebed93
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions source/niknaks/containers.d
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,17 @@ public class Graph(T)
this.value = value;
}

/**
* Obtains the value associated with
* this graph node
*
* Returns: the value `T`
*/
public T getValue()
{
return this.value;
}

/**
* Appends another graph node
* to the array of children
Expand Down Expand Up @@ -1054,6 +1065,10 @@ unittest
assert(treeOfStrings.opIndex!(Graph!(string))(1) == subtree_2);
assert(treeOfStrings.opIndex!(Graph!(string))(2) == subtree_3);

assert(treeOfStrings[0] == subtree_1.getValue());
assert(treeOfStrings[1] == subtree_2.getValue());
assert(treeOfStrings[2] == subtree_3.getValue());

InclusionStratergy!(string) strat = toDelegate(&Always!(string));
TouchStratergy!(string) touch = toDelegate(&DebugTouch!(string));

Expand Down

0 comments on commit 1ebed93

Please sign in to comment.