diff --git a/apps/calculation/test/calculation_store.cpp b/apps/calculation/test/calculation_store.cpp index 5e2a541d5..d67bceb8c 100644 --- a/apps/calculation/test/calculation_store.cpp +++ b/apps/calculation/test/calculation_store.cpp @@ -48,6 +48,12 @@ QUIZ_CASE(calculation_store) { assert_store_is(&store, result3); store.deleteAll(); +} + +QUIZ_CASE(calculation_display_exact_approximate) { + GlobalContext globalContext; + CalculationStore store; + store.push("1+3/4", &globalContext); store.push("ans+2/3", &globalContext); ::Calculation::Calculation * lastCalculation = store.calculationAtIndex(1); @@ -58,4 +64,18 @@ QUIZ_CASE(calculation_store) { lastCalculation = store.calculationAtIndex(2); quiz_assert(lastCalculation->shouldOnlyDisplayApproximateOutput(&globalContext) == true); quiz_assert(strcmp(lastCalculation->approximateOutputText(),"2.6366666666667") == 0); + + store.deleteAll(); + store.push("1/2", &globalContext); + lastCalculation = store.calculationAtIndex(1); + quiz_assert(lastCalculation->exactAndApproximateDisplayedOutputsAreEqual(&globalContext) == ::Calculation::Calculation::EqualSign::Equal); + quiz_assert(lastCalculation->shouldOnlyDisplayApproximateOutput(&globalContext) == false); + + store.deleteAll(); + store.push("1/3", &globalContext); + lastCalculation = store.calculationAtIndex(1); + quiz_assert(lastCalculation->exactAndApproximateDisplayedOutputsAreEqual(&globalContext) == ::Calculation::Calculation::EqualSign::Approximation); + quiz_assert(lastCalculation->shouldOnlyDisplayApproximateOutput(&globalContext) == false); + + store.deleteAll(); }