Poincare: Fix tests

Change-Id: Ie5f08a35dae854a16a3286a3015e9942c612948b
This commit is contained in:
Romain Goyet
2016-04-07 17:53:48 +02:00
parent 0ac978468a
commit e9f28c4f45
3 changed files with 15 additions and 3 deletions

View File

@@ -40,6 +40,7 @@ Expression * ExpressionBuilder::build(ExpressionMatch matches[]) {
assert(false);
break;
}
break;
case ExpressionBuilder::Action::BuildFromTypeAndValue:
switch(m_expressionType) {
case Expression::Type::Integer:

View File

@@ -27,6 +27,7 @@ private:
CallExternalGenerator
};
constexpr ExpressionBuilder(Expression::Type type, uint8_t numberOfChildren);
constexpr ExpressionBuilder(Expression::Type type, int32_t integerValue, uint8_t numberOfChildren);
constexpr ExpressionBuilder(Action action, uint8_t matchIndex, uint8_t numberOfChildren);
constexpr ExpressionBuilder(ExternalGenerator * generator, uint8_t numberOfChildren);
@@ -59,8 +60,9 @@ private:
constexpr ExpressionBuilder ExpressionBuilder::BuildFromType(
Expression::Type type,
uint8_t numberOfChildren) {
return ExpressionBuilder(type, 0, numberOfChildren);
return ExpressionBuilder(type, numberOfChildren);
}
constexpr ExpressionBuilder ExpressionBuilder::BuildFromTypeAndValue(
Expression::Type type,
int32_t value,
@@ -86,6 +88,15 @@ constexpr ExpressionBuilder ExpressionBuilder::CallExternalGenerator(
return ExpressionBuilder(generator, numberOfChildren);
}
constexpr ExpressionBuilder::ExpressionBuilder(Expression::Type type,
uint8_t numberOfChildren)
:
m_action(ExpressionBuilder::Action::BuildFromType),
m_expressionType(type),
m_integerValue(0),
m_numberOfChildren(numberOfChildren) {
}
constexpr ExpressionBuilder::ExpressionBuilder(Expression::Type type,
int32_t integerValue,
uint8_t numberOfChildren)

View File

@@ -1,3 +1,3 @@
Integer(a)->Integer(a);
Addition(Addition(a,b),c)->Addition(a,b,c);
Addition(Addition(a*),b*)->Addition(a*,b*);
Addition(Integer.a,Integer.b)->$AddIntegers(a,b);
Addition(Integer.a,Integer.b,c*)->Addition($AddIntegers(a,b),c*);