From 76a950d5727fc67a0caf4d4ebc2fb619825df8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Wed, 31 Jul 2019 17:46:06 +0200 Subject: [PATCH] [apps/calculation] Add assertions instead of escape cases --- apps/calculation/calculation.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/apps/calculation/calculation.cpp b/apps/calculation/calculation.cpp index 5a1d886bd..e9af5d91c 100644 --- a/apps/calculation/calculation.cpp +++ b/apps/calculation/calculation.cpp @@ -48,9 +48,7 @@ Expression Calculation::exactOutput() { * 'sqrt(2)/2 = 0.999906' (which is totally wrong) instead of * 'cos(pi/4) = 0.999906' (which is true in degree). */ Expression exactOutput = Expression::Parse(exactOutputText()); - if (exactOutput.isUninitialized()) { - return Undefined::Builder(); - } + assert(!exactOutput.isUninitialized()); return exactOutput; } @@ -58,12 +56,7 @@ Expression Calculation::approximateOutput(Context * context) { /* To ensure that the expression 'm_output' is a matrix or a complex, we * call 'evaluate'. */ Expression exp = Expression::Parse(approximateOutputText()); - if (exp.isUninitialized()) { - /* TODO LEA replace with assert - * exp might be uninitialized because the serialization did not fit in - * the buffer. Put a special error instead of "undef". */ - return Undefined::Builder(); - } + assert(!exp.isUninitialized()); return PoincareHelpers::Approximate(exp, context); }