Permalink
Browse files

Added assertions to linked list test, and fixed typo.

  • Loading branch information...
systay committed Jun 27, 2012
1 parent 55863d0 commit 15d9bb201ef1e320c91a80778336a4b122cdd019
@@ -28,9 +28,19 @@ class LinkedListTest extends ArticleTest with StatisticsChecker {
val title = "Linked List"
- override def assert(name:String, result:ExecutionResult) { name match {
- case "create" => assertStats(result, nodesCreated = 1, relationshipsCreated = 1, propertiesSet = 0)
- }}
+ override def assert(name: String, result: ExecutionResult) {
+ name match {
+ case "create" =>
+ assertStats(result, nodesCreated = 1, relationshipsCreated = 1, propertiesSet = 0)
+ assert(result.toList.size === 0)
+ case "add" =>
+ assertStats(result, nodesCreated = 1, relationshipsCreated = 2, propertiesSet = 1, deletedRelationships = 1)
+ assert(result.toList.size === 0)
+ case "delete" =>
+ assertStats(result, deletedNodes = 1, relationshipsCreated = 1, deletedRelationships = 2)
+ assert(result.toList.size === 0)
+ }
+ }
override val properties: Map[String, Map[String, Any]] = Map(
"A" -> Map("value" -> 10),
@@ -39,7 +49,6 @@ class LinkedListTest extends ArticleTest with StatisticsChecker {
)
-
def text = """
Linked Lists
============
@@ -65,7 +74,7 @@ RETURN root###
Adding values is done by finding the relationship where the new value should be placed in, and replacing it with
a new node, and two relationships to it.
-###no-results
+###no-results assertion=add
START root=node(%ROOT%)
MATCH root-[:LINK*0..]->before,// before could be same as root
after-[:LINK*0..]->root, // after could be same as root
@@ -78,7 +87,7 @@ DELETE old###
Deleting a value, conversely, is done by finding the node with the value, and the two relationships going in and out
from it, and replacing with a new value.
-###no-results
+###no-results assertion=delete
START root=node(%ROOT%)
MATCH root-[:LINK*0..]->before,
before-[delBefore:LINK]->del-[delAfter:LINK]->after,
@@ -57,7 +57,7 @@ include::path-tree-layout-full-range.txt[]
queryText = "START root=node:node_auto_index(name = 'Root') " +
"MATCH " +
"startPath=root-[:`2010`]->()-[:`12`]->()-[:`31`]->startLeaf, " +
- "endPath=root-[`:2011`]->()-[:`01`]->()-[:`03`]->endLeaf, " +
+ "endPath=root-[:`2011`]->()-[:`01`]->()-[:`03`]->endLeaf, " +
"valuePath=startLeaf-[:NEXT*0..]->middle-[:NEXT*0..]->endLeaf, " +
"values=middle-[:VALUE]->event " +
"RETURN event.name " +

0 comments on commit 15d9bb2

Please sign in to comment.