1
0
Fork 0

fixed failing tests

This commit is contained in:
Jan Steemann 2014-10-16 18:19:32 +02:00
parent a6b237b06e
commit 9311d74abc
2 changed files with 9 additions and 9 deletions

View File

@ -241,7 +241,7 @@ function explainSuite () {
assertEqual(5, node.id); assertEqual(5, node.id);
assertTrue(node.hasOwnProperty("expression")); assertTrue(node.hasOwnProperty("expression"));
assertEqual("a", node.outVariable.name); assertEqual("a", node.outVariable.name);
assertTrue(node.canThrow); assertFalse(node.canThrow);
node = nodes[5]; node = nodes[5];
assertEqual("SortNode", node.type); assertEqual("SortNode", node.type);

View File

@ -107,13 +107,13 @@ function optimizerRuleTestSuite () {
var queries = [ var queries = [
"FOR i IN 1..10 FOR j IN 1..10 FILTER i > 1 RETURN i", "FOR i IN 1..10 FOR j IN 1..10 FILTER i > 1 RETURN i",
"FOR i IN 1..10 LET x = (FOR j IN [i] RETURN j) FILTER i > 1 RETURN i", "FOR i IN 1..10 LET x = (FOR j IN [i] RETURN j) FILTER i > 1 RETURN i",
"FOR i IN 1..10 LET a = 2 * i FILTER i == 1 RETURN a", "FOR i IN 1..10 FOR l IN 1..10 LET a = 2 * i FILTER i == 1 RETURN a",
"FOR i IN 1..10 LET a = 2 * i FILTER i == 1 LIMIT 1 RETURN a" "FOR i IN 1..10 FOR l IN 1..10 LET a = 2 * i FILTER i == 1 LIMIT 1 RETURN a"
]; ];
queries.forEach(function(query) { queries.forEach(function(query) {
var result = AQL_EXPLAIN(query, { }, paramEnabled); var result = AQL_EXPLAIN(query, { }, paramEnabled);
assertTrue(result.plan.rules.indexOf(ruleName) === 1, query); assertNotEqual(-1, result.plan.rules.indexOf(ruleName), query);
}); });
}, },
@ -126,13 +126,13 @@ function optimizerRuleTestSuite () {
var plans = [ var plans = [
[ "FOR i IN 1..10 FOR j IN 1..10 FILTER i > 1 RETURN i", [ "SingletonNode", "CalculationNode", "CalculationNode", "EnumerateListNode", "CalculationNode", "FilterNode", "EnumerateListNode", "ReturnNode" ] ], [ "FOR i IN 1..10 FOR j IN 1..10 FILTER i > 1 RETURN i", [ "SingletonNode", "CalculationNode", "CalculationNode", "EnumerateListNode", "CalculationNode", "FilterNode", "EnumerateListNode", "ReturnNode" ] ],
[ "FOR i IN 1..10 LET x = (FOR j IN [i] RETURN j) FILTER i > 1 RETURN i", [ "SingletonNode", "CalculationNode", "EnumerateListNode", "CalculationNode", "FilterNode", "SubqueryNode", "ReturnNode" ] ], [ "FOR i IN 1..10 LET x = (FOR j IN [i] RETURN j) FILTER i > 1 RETURN i", [ "SingletonNode", "CalculationNode", "EnumerateListNode", "CalculationNode", "FilterNode", "SubqueryNode", "ReturnNode" ] ],
[ "FOR i IN 1..10 LET a = 2 * i FILTER i == 1 RETURN a", [ "SingletonNode", "CalculationNode", "EnumerateListNode", "CalculationNode", "FilterNode", "CalculationNode", "ReturnNode" ] ], [ "FOR i IN 1..10 FOR l IN 1..10 LET a = 2 * i FILTER i == 1 RETURN a", [ "SingletonNode", "CalculationNode", "CalculationNode", "EnumerateListNode", "CalculationNode", "CalculationNode", "FilterNode", "EnumerateListNode", "ReturnNode" ] ],
[ "FOR i IN 1..10 FOR j IN 1..10 FILTER i == 1 FILTER j == 2 RETURN i", [ "SingletonNode", "CalculationNode", "CalculationNode", "EnumerateListNode", "CalculationNode", "FilterNode", "EnumerateListNode", "CalculationNode", "FilterNode", "ReturnNode" ] ] [ "FOR i IN 1..10 FOR j IN 1..10 FILTER i == 1 FILTER j == 2 RETURN i", [ "SingletonNode", "CalculationNode", "CalculationNode", "EnumerateListNode", "CalculationNode", "FilterNode", "EnumerateListNode", "CalculationNode", "FilterNode", "ReturnNode" ] ]
]; ];
plans.forEach(function(plan) { plans.forEach(function(plan) {
var result = AQL_EXPLAIN(plan[0], { }, paramEnabled); var result = AQL_EXPLAIN(plan[0], { }, paramEnabled);
assertTrue(result.plan.rules.indexOf(ruleName) !== -1, plan[0]); assertNotEqual(-1, result.plan.rules.indexOf(ruleName), plan[0]);
assertEqual(plan[1], helper.getCompactPlan(result).map(function(node) { return node.type; }), plan[0]); assertEqual(plan[1], helper.getCompactPlan(result).map(function(node) { return node.type; }), plan[0]);
}); });
}, },
@ -145,7 +145,7 @@ function optimizerRuleTestSuite () {
var queries = [ var queries = [
[ "FOR i IN 1..10 FOR j IN 1..10 FILTER i > 9 RETURN j", [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] ], [ "FOR i IN 1..10 FOR j IN 1..10 FILTER i > 9 RETURN j", [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] ],
[ "FOR i IN 1..10 LET x = (FOR j IN [i] RETURN j) FILTER i > 9 RETURN x", [ [ 10 ] ] ], [ "FOR i IN 1..10 LET x = (FOR j IN [i] RETURN j) FILTER i > 9 RETURN x", [ [ 10 ] ] ],
[ "FOR i IN 1..10 LET a = 2 * i FILTER i == 1 RETURN a", [ 2 ] ], [ "FOR i IN 1..10 FOR l IN 1..1 LET a = 2 * i FILTER i == 1 RETURN a", [ 2 ] ],
[ "FOR i IN 1..10 LET a = i FOR j IN 1..10 LET b = j FILTER a == 1 FILTER b == 2 RETURN [ a, b ]", [ [ 1, 2 ] ] ] [ "FOR i IN 1..10 LET a = i FOR j IN 1..10 LET b = j FILTER a == 1 FILTER b == 2 RETURN [ a, b ]", [ [ 1, 2 ] ] ]
]; ];
@ -157,8 +157,8 @@ function optimizerRuleTestSuite () {
assertTrue(isEqual(resultDisabled, resultEnabled), query[0]); assertTrue(isEqual(resultDisabled, resultEnabled), query[0]);
assertTrue(planDisabled.plan.rules.indexOf(ruleName) === -1, query[0]); assertEqual(-1, planDisabled.plan.rules.indexOf(ruleName), query[0]);
assertTrue(planEnabled.plan.rules.indexOf(ruleName) !== -1, query[0]); assertNotEqual(-1, planEnabled.plan.rules.indexOf(ruleName), query[0]);
assertEqual(resultDisabled, query[1]); assertEqual(resultDisabled, query[1]);
assertEqual(resultEnabled, query[1]); assertEqual(resultEnabled, query[1]);