Poincare: Test the SimplifyAdditionInteger

Change-Id: Ic8146a509c0c6b3ace72900cbb9854d181783de7
This commit is contained in:
Romain Goyet
2016-03-24 15:51:41 +01:00
parent c43211cb45
commit ed95a3c564
2 changed files with 18 additions and 0 deletions

View File

@@ -3,9 +3,11 @@
#include "expression_lexer.hpp"
#include "simplify/simplify.h"
#include "simplify/simplify_product_zero.h"
#include "simplify/simplify_addition_integer.h"
static expression_simplifier_t kSimplifiers[] = {
&SimplifyProductZero,
&SimplifyAdditionInteger,
nullptr
};

View File

@@ -0,0 +1,16 @@
#include <quiz.h>
#include <poincare.h>
#include <assert.h>
QUIZ_CASE(poincare_simplify_addition_integer) {
{
Expression * e = Expression::parse("3+0");
Expression * e2 = e->simplify();
assert(e2->type() == Expression::Type::Integer);
}
{
Expression * e = Expression::parse("3+foo+2");
Expression * e2 = e->simplify();
assert(e2->type() == Expression::Type::Addition);
}
}