Skip to content

Commit 2fcac5a

Browse files
authored
Add index collect aggregate test (#59)
* Fix k shortest path tests * Add test for index collect aggregate
1 parent 08e2260 commit 2fcac5a

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

simple/test.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,15 @@ exports.test = function (global) {
16141614
}
16151615
},
16161616

1617+
indexCollectAggregate = function (params) {
1618+
db._query(
1619+
"FOR c IN @@c COLLECT group = doc.value1 AGGREGATE agg = SUM(doc.value2) RETURN [group, agg]",
1620+
{ "@c": params.collection },
1621+
{},
1622+
{ silent }
1623+
);
1624+
},
1625+
16171626
passthru = function (params) {
16181627
db._query(
16191628
"FOR c IN @@c RETURN NOOPT(" + params.name + "(@value))",
@@ -2158,6 +2167,17 @@ exports.test = function (global) {
21582167
name: "aql-collect-count-only-aggregator",
21592168
params: { func: collectCountOnly, explicitAggregator: true }
21602169
},
2170+
{
2171+
name: "aql-index-collect-aggregate",
2172+
params: {
2173+
func: indexCollectAggregate,
2174+
setup: function (params) {
2175+
drop(params);
2176+
create(params);
2177+
db[params.collection].ensureIndex({ type: "persistent", fields: ["value1", "value2"] });
2178+
}
2179+
}
2180+
},
21612181
{
21622182
name: "aql-subquery",
21632183
params: { func: subquery, attr: "value1" }
@@ -2571,11 +2591,11 @@ exports.test = function (global) {
25712591
},
25722592
{
25732593
name: "k-shortest-outbound",
2574-
params: { func: shortestOutbound }
2594+
params: { func: kShortestOutbound }
25752595
},
25762596
{
25772597
name: "k-shortest-any",
2578-
params: { func: shortestAny }
2598+
params: { func: kShortestAny }
25792599
},
25802600
{
25812601
name: "subquery-exists-path",

0 commit comments

Comments
 (0)