Skip to content

Commit

Permalink
Port over more steps from filter package of TP3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatiana Yavkina committed Aug 13, 2018
1 parent b00551a commit a44419a
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions gremlin-scala/src/test/scala/gremlin/scala/FilterSpec.scala
Expand Up @@ -66,6 +66,58 @@ class FilterSpec extends WordSpec with Matchers {
"ripple")
}

"coin all" in new Fixture {
graph.V.coin(1.0d).value(Name).toSet shouldBe Set("lop",
"marko",
"josh",
"vadas",
"ripple",
"peter")
}

"coin nothing" in new Fixture {
graph.V.coin(0.0d).value(Name).toSet shouldBe Set()
}

"dedup success" in new Fixture {
val a = StepLabel[Edge]()
val b = StepLabel[Vertex]()

graph.V.outE.as(a).inV.as(b)
.select(a).select(b).order(By(Name))
.value(Name)
.dedup()
.toList shouldBe List("josh", "lop", "ripple", "vadas")
}

"drop success" in new Fixture {
graph.V.outE.drop().toSet shouldBe Set()
}


"is usage" in new Fixture {
graph.V.value(Age).is(P.lte(30)).toSet shouldBe Set(27, 29)
}

"range success" in new Fixture {
val markoVertexId = 1
graph.V(markoVertexId).out("knows").out("created").range(0, 1).value(Name).toSet should contain oneOf("lop", "ripple")
}

"simple path" in new Fixture {
val markoVertexId = 1
graph.V(markoVertexId).out("created").in("created").simplePath.value(Name).toSet shouldBe Set("josh", "peter")
}

"tail" in new Fixture {
graph.V.value(Name).order.tail(2).toSet shouldBe Set("ripple", "vadas")
}

"where" in new Fixture {
val a = StepLabel[Vertex]()
graph.V.as(a).out("created").where(_.as(a).value(Name).is("josh")).in("created").value(Name).toSet shouldBe Set("marko", "josh", "peter")
}

trait Fixture {
val graph = TinkerFactory.createClassic.asScala
}
Expand Down

0 comments on commit a44419a

Please sign in to comment.