mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps/calculation] Test on equal/approximate display
This commit is contained in:
committed by
EmilieNumworks
parent
c7a405a3df
commit
6c5b0def7b
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user