Added Gremlin tests for the Except operator.

This commit is contained in:
Matei Chiperi 2014-08-28 18:56:06 -07:00
parent b97e6782ff
commit 55d235bd55
2 changed files with 17 additions and 3 deletions

View file

@ -146,11 +146,11 @@ func (it *Not) Type() graph.Type { return graph.Not }
func (it *Not) Optimize() (graph.Iterator, bool) {
// TODO - consider wrapping the primaryIt with a MaterializeIt
if optimizedPrimaryIt, optimized := it.primaryIt.Optimize(); optimized {
optimizedPrimaryIt, optimized := it.primaryIt.Optimize()
if optimized {
it.primaryIt = optimizedPrimaryIt
return it, true
}
return it, false
return it, optimized
}
func (it *Not) Stats() graph.IteratorStats {

View file

@ -120,6 +120,20 @@ var testQueries = []struct {
tag: "acd",
expect: []string{"D"},
},
{
message: "use Except to filter out a single vertex",
query: `
g.V("A", "B").Except(g.V("A")).All()
`,
expect: []string{"B"},
},
{
message: "use chained Except",
query: `
g.V("A", "B", "C").Except(g.V("B")).Except(g.V("C")).All()
`,
expect: []string{"A"},
},
// Morphism tests.
{