diff --git a/apps/calculation/test/calculation_store.cpp b/apps/calculation/test/calculation_store.cpp index 847fd01ad..dc1e7e02e 100644 --- a/apps/calculation/test/calculation_store.cpp +++ b/apps/calculation/test/calculation_store.cpp @@ -8,18 +8,18 @@ using namespace Calculation; void assert_store_is(CalculationStore * store, const char * result[10]) { for (int i = 0; i < store->numberOfCalculations(); i++) { - assert(strcmp(store->calculationAtIndex(i)->inputText(), result[i]) == 0); + quiz_assert(strcmp(store->calculationAtIndex(i)->inputText(), result[i]) == 0); } } QUIZ_CASE(calculation_store) { GlobalContext globalContext; CalculationStore store; - assert(CalculationStore::k_maxNumberOfCalculations == 10); + quiz_assert(CalculationStore::k_maxNumberOfCalculations == 10); for (int i = 0; i < CalculationStore::k_maxNumberOfCalculations; i++) { char text[2] = {(char)(i+'0'), 0}; store.push(text, &globalContext); - assert(store.numberOfCalculations() == i+1); + quiz_assert(store.numberOfCalculations() == i+1); } /* Store is now {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} */ const char * result[10] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}; @@ -40,7 +40,7 @@ QUIZ_CASE(calculation_store) { for (int i = 5; i < CalculationStore::k_maxNumberOfCalculations; i++) { char text[3] = {(char)(i+'0'), 0}; store.push(text, &globalContext); - assert(store.numberOfCalculations() == i+1); + quiz_assert(store.numberOfCalculations() == i+1); } /* Store is now {0, 2, 4, 6, 8, 5, 6, 7, 8, 9} */ const char * result3[10] = {"1", "3", "5", "7", "9", "5", "6", "7", "8", "9"}; @@ -50,11 +50,11 @@ QUIZ_CASE(calculation_store) { store.push("1+3/4", &globalContext); store.push("ans+2/3", &globalContext); ::Calculation::Calculation * lastCalculation = store.calculationAtIndex(1); - assert(lastCalculation->shouldOnlyDisplayApproximateOutput(&globalContext) == false); - assert(strcmp(lastCalculation->exactOutputText(),"29/12") == 0); + quiz_assert(lastCalculation->shouldOnlyDisplayApproximateOutput(&globalContext) == false); + quiz_assert(strcmp(lastCalculation->exactOutputText(),"29/12") == 0); store.push("ans+0.22", &globalContext); lastCalculation = store.calculationAtIndex(2); - assert(lastCalculation->shouldOnlyDisplayApproximateOutput(&globalContext) == true); - assert(strcmp(lastCalculation->approximateOutputText(),"2.6366666666667") == 0); + quiz_assert(lastCalculation->shouldOnlyDisplayApproximateOutput(&globalContext) == true); + quiz_assert(strcmp(lastCalculation->approximateOutputText(),"2.6366666666667") == 0); } diff --git a/apps/probability/test/erf_inv.cpp b/apps/probability/test/erf_inv.cpp index 35056929e..dc0fe0b55 100644 --- a/apps/probability/test/erf_inv.cpp +++ b/apps/probability/test/erf_inv.cpp @@ -6,13 +6,13 @@ #include "../law/erf_inv.h" QUIZ_CASE(erf_inv) { - assert(erfInv(0.0) == 0.0); - assert(std::isinf(erfInv(1.0)) && erfInv(1.0) > 0.0); - assert(std::isinf(erfInv(-1.0)) && erfInv(-1.0) < 0.0); - assert(std::fabs(erfInv(0.5) - 0.476936276204469873381418353643130559808969749059470644703) < DBL_EPSILON); - assert(std::fabs(erfInv(0.25) - 0.225312055012178104725014013952277554782118447807246757600) < DBL_EPSILON); - assert(std::fabs(erfInv(0.999999) - 3.458910737279500022150927635957569519915669808042886747076) < 10E-6); - assert(std::fabs(erfInv(0.123456) - 0.109850294001424923867673480939041914394684494884310054922) < DBL_EPSILON); + quiz_assert(erfInv(0.0) == 0.0); + quiz_assert(std::isinf(erfInv(1.0)) && erfInv(1.0) > 0.0); + quiz_assert(std::isinf(erfInv(-1.0)) && erfInv(-1.0) < 0.0); + quiz_assert(std::fabs(erfInv(0.5) - 0.476936276204469873381418353643130559808969749059470644703) < DBL_EPSILON); + quiz_assert(std::fabs(erfInv(0.25) - 0.225312055012178104725014013952277554782118447807246757600) < DBL_EPSILON); + quiz_assert(std::fabs(erfInv(0.999999) - 3.458910737279500022150927635957569519915669808042886747076) < 10E-6); + quiz_assert(std::fabs(erfInv(0.123456) - 0.109850294001424923867673480939041914394684494884310054922) < DBL_EPSILON); } diff --git a/apps/regression/test/model.cpp b/apps/regression/test/model.cpp index 595119ec0..0df117c11 100644 --- a/apps/regression/test/model.cpp +++ b/apps/regression/test/model.cpp @@ -30,7 +30,7 @@ void assert_regression_is(double * xi, double * yi, int numberOfPoints, Model::T // Comapre the coefficients int numberOfCoefs = store.modelForSeries(series)->numberOfCoefficients(); for (int i = 0; i < numberOfCoefs; i++) { - assert(std::fabs(coefficients[i] - trueCoefficients[i]) < precision); + quiz_assert(std::fabs(coefficients[i] - trueCoefficients[i]) < precision); } } diff --git a/apps/sequence/test/sequence.cpp b/apps/sequence/test/sequence.cpp index c07376a23..dfd0291a3 100644 --- a/apps/sequence/test/sequence.cpp +++ b/apps/sequence/test/sequence.cpp @@ -18,7 +18,7 @@ void check_sequences_defined_by(double result[2][10], Sequence::Type typeU, cons Sequence * v = nullptr; if (definitionU) { u = static_cast(store.addEmptyModel()); - assert(u->name()[0] == 'u'); + quiz_assert(u->name()[0] == 'u'); u->setType(typeU); u->setContent(definitionU); if (conditionU1) { @@ -35,7 +35,7 @@ void check_sequences_defined_by(double result[2][10], Sequence::Type typeU, cons store.removeModel(tempU); v = store.modelAtIndex(0); } else { - assert(store.numberOfModels() == 1); + quiz_assert(store.numberOfModels() == 1); v = static_cast(store.addEmptyModel()); } v->setType(typeV); @@ -50,11 +50,11 @@ void check_sequences_defined_by(double result[2][10], Sequence::Type typeU, cons for (int j = 0; j < 10; j++) { if (u && u->isDefined()) { double un = u->evaluateAtAbscissa((double)j, &sequenceContext); - assert((std::isnan(un) && std::isnan(result[0][j])) || (un == result[0][j])); + quiz_assert((std::isnan(un) && std::isnan(result[0][j])) || (un == result[0][j])); } if (v && v->isDefined()) { double vn = v->evaluateAtAbscissa((double)j, &sequenceContext); - assert((std::isnan(vn) && std::isnan(result[1][j])) || (vn == result[1][j])); + quiz_assert((std::isnan(vn) && std::isnan(result[1][j])) || (vn == result[1][j])); } } } diff --git a/apps/solver/test/equation_store.cpp b/apps/solver/test/equation_store.cpp index f4cc21f93..58de08714 100644 --- a/apps/solver/test/equation_store.cpp +++ b/apps/solver/test/equation_store.cpp @@ -22,27 +22,27 @@ void assert_equation_system_exact_solve_to(const char * equations[], EquationSto e->setContent(buffer); } EquationStore::Error err = equationStore.exactSolve(&globalContext); - assert(err == error); + quiz_assert(err == error); if (err != EquationStore::Error::NoError) { return; } - assert(equationStore.type() == type); - assert(equationStore.numberOfSolutions() == numberOfSolutions); + quiz_assert(equationStore.type() == type); + quiz_assert(equationStore.numberOfSolutions() == numberOfSolutions); if (numberOfSolutions == INT_MAX) { return; } if (type == EquationStore::Type::LinearSystem) { for (int i = 0; i < numberOfSolutions; i++) { - assert(equationStore.variableAtIndex(i) == variables[i]); + quiz_assert(equationStore.variableAtIndex(i) == variables[i]); } } else { - assert(equationStore.variableAtIndex(0) == variables[0]); + quiz_assert(equationStore.variableAtIndex(0) == variables[0]); } int n = type == EquationStore::Type::PolynomialMonovariable ? numberOfSolutions+1 : numberOfSolutions; // Check Delta for PolynomialMonovariable for (int i = 0; i < n; i++) { equationStore.exactSolutionLayoutAtIndex(i, true)->serialize(buffer, 200); translate_in_ASCII_chars(buffer); - assert(strcmp(buffer, solutions[i]) == 0); + quiz_assert(strcmp(buffer, solutions[i]) == 0); } } @@ -55,16 +55,16 @@ void assert_equation_approximate_solve_to(const char * equations, double xMin, d translate_in_special_chars(buffer); e->setContent(buffer); EquationStore::Error err = equationStore.exactSolve(&globalContext); - assert(err == EquationStore::Error::RequireApproximateSolution); + quiz_assert(err == EquationStore::Error::RequireApproximateSolution); equationStore.setIntervalBound(0, xMin); equationStore.setIntervalBound(1, xMax); equationStore.approximateSolve(&globalContext); - assert(equationStore.numberOfSolutions() == numberOfSolutions); - assert(equationStore.variableAtIndex(0) == variable); + quiz_assert(equationStore.numberOfSolutions() == numberOfSolutions); + quiz_assert(equationStore.variableAtIndex(0) == variable); for (int i = 0; i < numberOfSolutions; i++) { - assert(std::fabs(equationStore.approximateSolutionAtIndex(i) - solutions[i]) < 1E-5); + quiz_assert(std::fabs(equationStore.approximateSolutionAtIndex(i) - solutions[i]) < 1E-5); } - assert(equationStore.haveMoreApproximationSolutions(&globalContext) == hasMoreSolutions); + quiz_assert(equationStore.haveMoreApproximationSolutions(&globalContext) == hasMoreSolutions); } QUIZ_CASE(equation_solve) { diff --git a/ion/test/crc32.cpp b/ion/test/crc32.cpp index be5cb1f65..daee8758f 100644 --- a/ion/test/crc32.cpp +++ b/ion/test/crc32.cpp @@ -4,7 +4,7 @@ QUIZ_CASE(ion_crc32) { uint32_t input[] = { 0x48656C6C, 0x6F2C2077 }; - assert(Ion::crc32(input, 1) == 0x93591FFD); - assert(Ion::crc32(input, 2) == 0x72EAD3FB); + quiz_assert(Ion::crc32(input, 1) == 0x93591FFD); + quiz_assert(Ion::crc32(input, 2) == 0x72EAD3FB); } diff --git a/ion/test/events.cpp b/ion/test/events.cpp index cd446f2eb..80d339dad 100644 --- a/ion/test/events.cpp +++ b/ion/test/events.cpp @@ -8,15 +8,15 @@ using namespace Ion::Events; QUIZ_CASE(ion_events_from_keyboard) { /* Ensure all events generated from the keyboard are properly defined */ for (Key k : ValidKeys) { - assert(Event(k, false, false).isDefined()); - assert(Event(k, true, false).isDefined()); - assert(Event(k, false, true).isDefined()); - assert(Event(k, true, true).isDefined()); + quiz_assert(Event(k, false, false).isDefined()); + quiz_assert(Event(k, true, false).isDefined()); + quiz_assert(Event(k, false, true).isDefined()); + quiz_assert(Event(k, true, true).isDefined()); } // Test some fallbacks - assert(Event(Key::I5, false, false) == EXE); - assert(Event(Key::I5, true, false) == EXE); - assert(Event(Key::I5, false, true) == EXE); - assert(Event(Key::I5, true, true) == EXE); + quiz_assert(Event(Key::I5, false, false) == EXE); + quiz_assert(Event(Key::I5, true, false) == EXE); + quiz_assert(Event(Key::I5, false, true) == EXE); + quiz_assert(Event(Key::I5, true, true) == EXE); } diff --git a/ion/test/keyboard.cpp b/ion/test/keyboard.cpp index 95657e280..b1c4d9519 100644 --- a/ion/test/keyboard.cpp +++ b/ion/test/keyboard.cpp @@ -7,7 +7,7 @@ using namespace Ion::Keyboard; QUIZ_CASE(ion_keyboard) { for (Key k : ValidKeys) { for (Key l : ValidKeys) { - assert(State(k).keyDown(l) == (k == l)); + quiz_assert(State(k).keyDown(l) == (k == l)); } } } diff --git a/kandinsky/test/color.cpp b/kandinsky/test/color.cpp index b7a80c608..e9bd1fa90 100644 --- a/kandinsky/test/color.cpp +++ b/kandinsky/test/color.cpp @@ -3,24 +3,24 @@ #include QUIZ_CASE(kandinsky_color_rgb) { - assert(sizeof(KDColor) == 2); // We really want KDColor to be packed + quiz_assert(sizeof(KDColor) == 2); // We really want KDColor to be packed - assert(KDColor::RGB24(0xFF0000) == 0xF800); - assert(KDColor::RGB24(0x00FF00) == 0x07E0); - assert(KDColor::RGB24(0x0000FF) == 0x1F); + quiz_assert(KDColor::RGB24(0xFF0000) == 0xF800); + quiz_assert(KDColor::RGB24(0x00FF00) == 0x07E0); + quiz_assert(KDColor::RGB24(0x0000FF) == 0x1F); /* R = 0x12 = 0b 0001 0010. 5 most important bits are 00010. * G = 0x34 = 0b 0011 0100. 6 most important bits are 001101. * B = 0x56 = 0b 0101 0110. 5 most important bits are 01010. * KDColor = 0b 00010 001101 01010 * = 0b 0001 0001 1010 1010 * = 0x 1 1 A A */ - assert(KDColor::RGB24(0x123456) == 0x11AA); + quiz_assert(KDColor::RGB24(0x123456) == 0x11AA); } QUIZ_CASE(kandinsky_color_blend) { KDColor midGray = KDColor::RGB24(0x7F7F7F); KDColor res = KDColor::blend(KDColorWhite, KDColorBlack, 0xFF); - assert(res == KDColorWhite); - assert(KDColor::blend(KDColorWhite, KDColorBlack, 0) == KDColorBlack); - assert(KDColor::blend(KDColorWhite, KDColorBlack, 0x7F) == midGray); + quiz_assert(res == KDColorWhite); + quiz_assert(KDColor::blend(KDColorWhite, KDColorBlack, 0) == KDColorBlack); + quiz_assert(KDColor::blend(KDColorWhite, KDColorBlack, 0x7F) == midGray); } diff --git a/kandinsky/test/rect.cpp b/kandinsky/test/rect.cpp index eb313a119..15cf32470 100644 --- a/kandinsky/test/rect.cpp +++ b/kandinsky/test/rect.cpp @@ -5,20 +5,20 @@ QUIZ_CASE(kandinsky_rect_intersect) { KDRect a(-5,-5, 10, 10); KDRect b(0, 0, 10, 10); - assert(a.intersects(b)); - assert(b.intersects(a)); + quiz_assert(a.intersects(b)); + quiz_assert(b.intersects(a)); KDRect c = a.intersectedWith(b); KDRect result(0, 0, 5, 5); - assert(c == result); + quiz_assert(c == result); c = b.intersectedWith(a); - assert(c == result); + quiz_assert(c == result); } QUIZ_CASE(kandinsky_rect_union) { KDRect a(-5, -5, 10, 10); KDRect b(0, 0, 10, 10); KDRect c = a.unionedWith(b); - assert(c == KDRect(-5, -5, 15, 15)); + quiz_assert(c == KDRect(-5, -5, 15, 15)); } QUIZ_CASE(kandinsky_rect_empty_union) { @@ -27,13 +27,13 @@ QUIZ_CASE(kandinsky_rect_empty_union) { KDRect c(-2, -1, 0, 1); KDRect t = a.unionedWith(b); - assert(t == a); + quiz_assert(t == a); t = b.unionedWith(a); - assert(t == a); + quiz_assert(t == a); t = a.unionedWith(c); - assert(t == a); + quiz_assert(t == a); } QUIZ_CASE(kandinsky_rect_difference) { @@ -45,35 +45,35 @@ QUIZ_CASE(kandinsky_rect_difference) { KDRect f(2, -4, 3, 3); KDRect t = e.differencedWith(a); - assert(t == e); + quiz_assert(t == e); t = a.differencedWith(e); - assert(t == KDRectZero); + quiz_assert(t == KDRectZero); t = f.differencedWith(d); - assert(t == f); + quiz_assert(t == f); t = f.differencedWith(e); - assert(t == f); + quiz_assert(t == f); t = b.differencedWith(e); - assert(t == b); + quiz_assert(t == b); t = c.differencedWith(f); - assert(t == KDRect(3, -1, 1, 4)); + quiz_assert(t == KDRect(3, -1, 1, 4)); t = c.differencedWith(a); - assert(t == c); + quiz_assert(t == c); t = c.differencedWith(e); - assert(t == KDRect(3, -2, 1, 1)); + quiz_assert(t == KDRect(3, -2, 1, 1)); t = a.differencedWith(b); - assert(t == KDRect(0, 0, 10, 2)); + quiz_assert(t == KDRect(0, 0, 10, 2)); t = a.differencedWith(c); - assert(t == a); + quiz_assert(t == a); t = a.differencedWith(d); - assert(t == KDRect(-1, 0, 8, 2)); + quiz_assert(t == KDRect(-1, 0, 8, 2)); } diff --git a/liba/test/aeabi.c b/liba/test/aeabi.c index d4fc48aa3..0bfac2e79 100644 --- a/liba/test/aeabi.c +++ b/liba/test/aeabi.c @@ -6,37 +6,37 @@ long long __aeabi_llsl(long long value, int shift); long long __aeabi_llsr(long long value, int shift); QUIZ_CASE(liba_llsl) { - assert(__aeabi_llsl((uint64_t)1, 1) == (uint64_t)0x2); - assert(__aeabi_llsl((uint64_t)1, 2) == (uint64_t)0x4); - assert(__aeabi_llsl((uint64_t)1, 10) == (uint64_t)0x400); - assert(__aeabi_llsl((uint64_t)1, 20) == (uint64_t)0x100000); - assert(__aeabi_llsl((uint64_t)1, 30) == (uint64_t)0x40000000); - assert(__aeabi_llsl((uint64_t)1, 31) == (uint64_t)0x80000000); - assert(__aeabi_llsl((uint64_t)1, 32) == (uint64_t)0x100000000); - assert(__aeabi_llsl((uint64_t)1, 33) == (uint64_t)0x200000000); - assert(__aeabi_llsl((uint64_t)1, 40) == (uint64_t)0x10000000000); - assert(__aeabi_llsl((uint64_t)1, 50) == (uint64_t)0x4000000000000); - assert(__aeabi_llsl((uint64_t)1, 60) == (uint64_t)0x1000000000000000); - assert(__aeabi_llsl((uint64_t)1, 61) == (uint64_t)0x2000000000000000); - assert(__aeabi_llsl((uint64_t)1, 62) == (uint64_t)0x4000000000000000); - assert(__aeabi_llsl((uint64_t)1, 63) == (uint64_t)0x8000000000000000); - assert(__aeabi_llsl((uint64_t)1, 64) == (uint64_t)0); + quiz_assert(__aeabi_llsl((uint64_t)1, 1) == (uint64_t)0x2); + quiz_assert(__aeabi_llsl((uint64_t)1, 2) == (uint64_t)0x4); + quiz_assert(__aeabi_llsl((uint64_t)1, 10) == (uint64_t)0x400); + quiz_assert(__aeabi_llsl((uint64_t)1, 20) == (uint64_t)0x100000); + quiz_assert(__aeabi_llsl((uint64_t)1, 30) == (uint64_t)0x40000000); + quiz_assert(__aeabi_llsl((uint64_t)1, 31) == (uint64_t)0x80000000); + quiz_assert(__aeabi_llsl((uint64_t)1, 32) == (uint64_t)0x100000000); + quiz_assert(__aeabi_llsl((uint64_t)1, 33) == (uint64_t)0x200000000); + quiz_assert(__aeabi_llsl((uint64_t)1, 40) == (uint64_t)0x10000000000); + quiz_assert(__aeabi_llsl((uint64_t)1, 50) == (uint64_t)0x4000000000000); + quiz_assert(__aeabi_llsl((uint64_t)1, 60) == (uint64_t)0x1000000000000000); + quiz_assert(__aeabi_llsl((uint64_t)1, 61) == (uint64_t)0x2000000000000000); + quiz_assert(__aeabi_llsl((uint64_t)1, 62) == (uint64_t)0x4000000000000000); + quiz_assert(__aeabi_llsl((uint64_t)1, 63) == (uint64_t)0x8000000000000000); + quiz_assert(__aeabi_llsl((uint64_t)1, 64) == (uint64_t)0); } QUIZ_CASE(liba_llsr) { - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 1) == (uint64_t)0x4000000000000000); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 2) == (uint64_t)0x2000000000000000); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 10) == (uint64_t)0x20000000000000); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 20) == (uint64_t)0x80000000000); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 30) == (uint64_t)0x200000000); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 31) == (uint64_t)0x100000000); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 32) == (uint64_t)0x80000000); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 33) == (uint64_t)0x40000000); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 40) == (uint64_t)0x800000); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 50) == (uint64_t)0x2000); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 60) == (uint64_t)0x8); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 61) == (uint64_t)0x4); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 62) == (uint64_t)0x2); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 63) == (uint64_t)0x1); - assert(__aeabi_llsr((uint64_t)0x8000000000000000, 64) == (uint64_t)0); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 1) == (uint64_t)0x4000000000000000); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 2) == (uint64_t)0x2000000000000000); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 10) == (uint64_t)0x20000000000000); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 20) == (uint64_t)0x80000000000); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 30) == (uint64_t)0x200000000); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 31) == (uint64_t)0x100000000); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 32) == (uint64_t)0x80000000); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 33) == (uint64_t)0x40000000); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 40) == (uint64_t)0x800000); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 50) == (uint64_t)0x2000); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 60) == (uint64_t)0x8); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 61) == (uint64_t)0x4); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 62) == (uint64_t)0x2); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 63) == (uint64_t)0x1); + quiz_assert(__aeabi_llsr((uint64_t)0x8000000000000000, 64) == (uint64_t)0); } diff --git a/liba/test/double.c b/liba/test/double.c index 1b2dc0d9e..1b3173db2 100644 --- a/liba/test/double.c +++ b/liba/test/double.c @@ -2,17 +2,17 @@ #include QUIZ_CASE(double_arithmetic) { - assert((float)1.123456789101112 == 1.123456789101112f); - assert((double)1.12345f - 1.12345< 0.0000001); - assert(3.12+2.00001 - 5.12001 < 0.0000000001); - assert(1e106+1e104 - 1.01e106 < 0.0000000001); - assert(1e-106+1e-104 - 1.01e104 < 0.0000000001); - assert(3.12345678901234567890/2.0000000000000001 - 1.56172839450617276136 < 0.0000000001); - assert(1.09876e206/2.45678e207 - 0.04472358127304846180773 < 0.0000000001); - assert(3.12345678901234567890*2.0000000000000001 - 6.24691357802469167014 < 0.0000000001); - assert(1.09876e106*2.45678e107 - 2.6994115928e213 < 0.0000000001); - assert(-3.12345678901234567890+2.0000000000000001 == -1.1234567890123457); - assert(-1e36+1e34 + 9.9e35 < 0.0000000001); - assert(3.12345678901234567890-2.0000000000000001 == 1.1234567890123457); - assert(1e36-1e34 - 9.9e35 < 0.0000000001); + quiz_assert((float)1.123456789101112 == 1.123456789101112f); + quiz_assert((double)1.12345f - 1.12345< 0.0000001); + quiz_assert(3.12+2.00001 - 5.12001 < 0.0000000001); + quiz_assert(1e106+1e104 - 1.01e106 < 0.0000000001); + quiz_assert(1e-106+1e-104 - 1.01e104 < 0.0000000001); + quiz_assert(3.12345678901234567890/2.0000000000000001 - 1.56172839450617276136 < 0.0000000001); + quiz_assert(1.09876e206/2.45678e207 - 0.04472358127304846180773 < 0.0000000001); + quiz_assert(3.12345678901234567890*2.0000000000000001 - 6.24691357802469167014 < 0.0000000001); + quiz_assert(1.09876e106*2.45678e107 - 2.6994115928e213 < 0.0000000001); + quiz_assert(-3.12345678901234567890+2.0000000000000001 == -1.1234567890123457); + quiz_assert(-1e36+1e34 + 9.9e35 < 0.0000000001); + quiz_assert(3.12345678901234567890-2.0000000000000001 == 1.1234567890123457); + quiz_assert(1e36-1e34 - 9.9e35 < 0.0000000001); } diff --git a/liba/test/ieee754.c b/liba/test/ieee754.c index 8c3fda649..af42033d9 100644 --- a/liba/test/ieee754.c +++ b/liba/test/ieee754.c @@ -4,18 +4,18 @@ #include QUIZ_CASE(liba_ieee754) { - assert(ieee754man32(123.456f) == 7793017); - assert(ieee754exp32(123.456f) == 133); - assert(ieee754man32(555.555f) == 713605); - assert(ieee754exp32(555.555f) == 136); - assert(ieee754man32(0.007f) == 6643778); - assert(ieee754exp32(0.007f) == 119); - assert(ieee754man64(123.456) == 0b1110110111010010111100011010100111111011111001110111); - assert(ieee754exp64(123.456) == 0b10000000101); - assert(ieee754man64(555.555) == 0b0001010111000111000010100011110101110000101000111101); - assert(ieee754exp64(555.555) == 0b10000001000); - assert(ieee754man64(0.007) == 0b1100101011000000100000110001001001101110100101111001); - assert(ieee754exp64(0.007) == 0b01111110111); - assert(isinf(INFINITY)); - assert(isinf((double)INFINITY)); + quiz_assert(ieee754man32(123.456f) == 7793017); + quiz_assert(ieee754exp32(123.456f) == 133); + quiz_assert(ieee754man32(555.555f) == 713605); + quiz_assert(ieee754exp32(555.555f) == 136); + quiz_assert(ieee754man32(0.007f) == 6643778); + quiz_assert(ieee754exp32(0.007f) == 119); + quiz_assert(ieee754man64(123.456) == 0b1110110111010010111100011010100111111011111001110111); + quiz_assert(ieee754exp64(123.456) == 0b10000000101); + quiz_assert(ieee754man64(555.555) == 0b0001010111000111000010100011110101110000101000111101); + quiz_assert(ieee754exp64(555.555) == 0b10000001000); + quiz_assert(ieee754man64(0.007) == 0b1100101011000000100000110001001001101110100101111001); + quiz_assert(ieee754exp64(0.007) == 0b01111110111); + quiz_assert(isinf(INFINITY)); + quiz_assert(isinf((double)INFINITY)); } diff --git a/liba/test/long.c b/liba/test/long.c index fae92e421..068648c59 100644 --- a/liba/test/long.c +++ b/liba/test/long.c @@ -3,14 +3,14 @@ #include void assert_int64t_approximatively_equals_int64t(int64_t i, int64_t j) { - assert(i-j < 1000000); - assert(j-i < 1000000); + quiz_assert(i-j < 1000000); + quiz_assert(j-i < 1000000); } QUIZ_CASE(long_arithmetic) { int64_t i = 123456789101112; - assert((float)i == 1.23456789101112e14f); - assert((double)i == 1.23456789101112e14); + quiz_assert((float)i == 1.23456789101112e14f); + quiz_assert((double)i == 1.23456789101112e14); float f = 123456789101112.12345f; assert_int64t_approximatively_equals_int64t((int64_t)f, 123456789101112); double d = 123456789101112.12345f; diff --git a/liba/test/setjmp.c b/liba/test/setjmp.c index fe33cc6ec..be3433c8f 100644 --- a/liba/test/setjmp.c +++ b/liba/test/setjmp.c @@ -10,5 +10,5 @@ QUIZ_CASE(set_jmp_long_jmp) { } int newres = (0 == res) ? res : res + 1; longjmp(env, newres); - assert(false); + quiz_assert(false); } diff --git a/liba/test/stddef.c b/liba/test/stddef.c index 06a845643..34bd1d3c4 100644 --- a/liba/test/stddef.c +++ b/liba/test/stddef.c @@ -4,10 +4,10 @@ #include "helpers.h" QUIZ_CASE(liba_stddef) { - assert(NULL == 0); + quiz_assert(NULL == 0); assert_unsigned(size_t); - assert(sizeof(size_t) == __SIZEOF_SIZE_T__); + quiz_assert(sizeof(size_t) == __SIZEOF_SIZE_T__); assert_signed(ssize_t); - assert(sizeof(ssize_t) == __SIZEOF_SIZE_T__); + quiz_assert(sizeof(ssize_t) == __SIZEOF_SIZE_T__); } diff --git a/liba/test/stdint.c b/liba/test/stdint.c index 04645b838..6392c4efb 100644 --- a/liba/test/stdint.c +++ b/liba/test/stdint.c @@ -4,18 +4,18 @@ #include "helpers.h" QUIZ_CASE(liba_stdint_size) { - assert(sizeof(uint8_t) == 1); - assert(sizeof(uint16_t) == 2); - assert(sizeof(uint32_t) == 4); - assert(sizeof(uint64_t) == 8); + quiz_assert(sizeof(uint8_t) == 1); + quiz_assert(sizeof(uint16_t) == 2); + quiz_assert(sizeof(uint32_t) == 4); + quiz_assert(sizeof(uint64_t) == 8); - assert(sizeof(int8_t) == 1); - assert(sizeof(int16_t) == 2); - assert(sizeof(int32_t) == 4); - assert(sizeof(int64_t) == 8); + quiz_assert(sizeof(int8_t) == 1); + quiz_assert(sizeof(int16_t) == 2); + quiz_assert(sizeof(int32_t) == 4); + quiz_assert(sizeof(int64_t) == 8); - assert(sizeof(uintptr_t) == sizeof(void *)); - assert(sizeof(intptr_t) == sizeof(void *)); + quiz_assert(sizeof(uintptr_t) == sizeof(void *)); + quiz_assert(sizeof(intptr_t) == sizeof(void *)); } QUIZ_CASE(liba_stdint_signedness) { diff --git a/liba/test/strlcpy.c b/liba/test/strlcpy.c index aed30128c..7c3544d6c 100644 --- a/liba/test/strlcpy.c +++ b/liba/test/strlcpy.c @@ -6,7 +6,7 @@ QUIZ_CASE(liba_strlcpy) { char * t = "Hello"; char buffer[16]; size_t result = strlcpy(buffer, t, 2); - assert(result == 1); - assert(buffer[0] == 'H'); - assert(buffer[1] == NULL); + quiz_assert(result == 1); + quiz_assert(buffer[0] == 'H'); + quiz_assert(buffer[1] == NULL); } diff --git a/poincare/test/addition.cpp b/poincare/test/addition.cpp index 1defb160e..f6538e04d 100644 --- a/poincare/test/addition.cpp +++ b/poincare/test/addition.cpp @@ -9,13 +9,13 @@ using namespace Poincare; static inline void assert_approximation_equals(const Expression i, float f) { Poincare::GlobalContext c; - assert(i.approximateToScalar(c, Preferences::AngleUnit::Degree) == f); + quiz_assert(i.approximateToScalar(c, Preferences::AngleUnit::Degree) == f); } static inline void assert_parsed_expression_is_equal_to(const char * exp, Expression e) { Expression result = Expression::parse(exp); - assert(!result.isUninitialized()); - assert(result.isIdenticalTo(e)); + quiz_assert(!result.isUninitialized()); + quiz_assert(result.isIdenticalTo(e)); } QUIZ_CASE(poincare_addition_cast_does_not_copy) { @@ -23,9 +23,9 @@ QUIZ_CASE(poincare_addition_cast_does_not_copy) { Integer i2(2); Addition j(i1, i2); Expression k = j; - assert(k.identifier() == (static_cast(k)).identifier()); - assert(i1.identifier() == (static_cast(i1)).identifier()); - assert(k.identifier() == (static_cast(k)).identifier()); + quiz_assert(k.identifier() == (static_cast(k)).identifier()); + quiz_assert(i1.identifier() == (static_cast(i1)).identifier()); + quiz_assert(k.identifier() == (static_cast(k)).identifier()); } QUIZ_CASE(poincare_addition_without_parsing) { diff --git a/poincare/test/arithmetic.cpp b/poincare/test/arithmetic.cpp index cf50201c5..823c3b91f 100644 --- a/poincare/test/arithmetic.cpp +++ b/poincare/test/arithmetic.cpp @@ -22,7 +22,7 @@ void assert_gcd_equals_to(Integer a, Integer b, Integer c) { #if POINCARE_TESTS_PRINT_EXPRESSIONS cout << gcd.approximate() << endl; #endif - assert(gcd.isEqualTo(c)); + quiz_assert(gcd.isEqualTo(c)); } void assert_lcm_equals_to(Integer a, Integer b, Integer c) { @@ -35,7 +35,7 @@ void assert_lcm_equals_to(Integer a, Integer b, Integer c) { #if POINCARE_TESTS_PRINT_EXPRESSIONS cout << lcm.approximate() << endl; #endif - assert(lcm.isEqualTo(c)); + quiz_assert(lcm.isEqualTo(c)); } void assert_prime_factorization_equals_to(Integer a, int * factors, int * coefficients, int length) { @@ -57,8 +57,8 @@ void assert_prime_factorization_equals_to(Integer a, int * factors, int * coeffi * (the relation between integers and their approximation is a surjection, * however different integers are really likely to have different * approximations... */ - assert(outputFactors[index].approximate() == Integer(factors[index]).approximate()); - assert(outputCoefficients[index].approximate() == Integer(coefficients[index]).approximate()); + quiz_assert(outputFactors[index].approximate() == Integer(factors[index]).approximate()); + quiz_assert(outputCoefficients[index].approximate() == Integer(coefficients[index]).approximate()); } } diff --git a/poincare/test/convert_expression_to_text.cpp b/poincare/test/convert_expression_to_text.cpp index 52ad534d3..0ac06740a 100644 --- a/poincare/test/convert_expression_to_text.cpp +++ b/poincare/test/convert_expression_to_text.cpp @@ -22,14 +22,14 @@ void assert_float_prints_to(T a, const char * result, Preferences::PrintFloatMod PrintFloat::convertFloatToText(a, buffer, bufferSize, significantDigits, mode); for (int i=0; ieditableChild(2), ExpressionLayoutCursor::Position::Left); cursor.addFractionLayoutAndCollapseSiblings(); assert_expression_layout_serialize_to(layout, "(12)/(34)+5"); - assert(cursor.isEquivalentTo(ExpressionLayoutCursor(layout->editableChild(0)->editableChild(1), ExpressionLayoutCursor::Position::Left))); + quiz_assert(cursor.isEquivalentTo(ExpressionLayoutCursor(layout->editableChild(0)->editableChild(1), ExpressionLayoutCursor::Position::Left))); delete layout; } @@ -36,7 +36,7 @@ QUIZ_CASE(poincare_fraction_layout_delete) { ExpressionLayoutCursor cursor1(layout1->editableChild(0)->editableChild(1), ExpressionLayoutCursor::Position::Left); cursor1.performBackspace(); assert_expression_layout_serialize_to(layout1, "1234"); - assert(cursor1.isEquivalentTo(ExpressionLayoutCursor(layout1->editableChild(1), ExpressionLayoutCursor::Position::Right))); + quiz_assert(cursor1.isEquivalentTo(ExpressionLayoutCursor(layout1->editableChild(1), ExpressionLayoutCursor::Position::Right))); delete layout1; /* ΓΈ @@ -54,7 +54,7 @@ QUIZ_CASE(poincare_fraction_layout_delete) { ExpressionLayoutCursor cursor2(layout2->editableChild(2)->editableChild(1), ExpressionLayoutCursor::Position::Left); cursor2.performBackspace(); assert_expression_layout_serialize_to(layout2, "1+3"); - assert(cursor2.isEquivalentTo(ExpressionLayoutCursor(layout2->editableChild(1), ExpressionLayoutCursor::Position::Right))); + quiz_assert(cursor2.isEquivalentTo(ExpressionLayoutCursor(layout2->editableChild(1), ExpressionLayoutCursor::Position::Right))); delete layout2; } diff --git a/poincare/test/function.cpp b/poincare/test/function.cpp index e82b2fe4c..4e1691ef7 100644 --- a/poincare/test/function.cpp +++ b/poincare/test/function.cpp @@ -11,8 +11,8 @@ template void assert_exp_is_bounded(Expression exp, T lowBound, T upBound, bool upBoundIncluded = false) { GlobalContext globalContext; T result = exp.approximateToScalar(globalContext, Radian); - assert(result >= lowBound); - assert(result < upBound || (result == upBound && upBoundIncluded)); + quiz_assert(result >= lowBound); + quiz_assert(result < upBound || (result == upBound && upBoundIncluded)); } QUIZ_CASE(poincare_parse_function) { diff --git a/poincare/test/helper.cpp b/poincare/test/helper.cpp index 1822b4fcc..47a5ffe04 100644 --- a/poincare/test/helper.cpp +++ b/poincare/test/helper.cpp @@ -49,25 +49,25 @@ Expression parse_expression(const char * expression) { strlcpy(buffer, expression, sizeof(buffer)); translate_in_special_chars(buffer); Expression result = Expression::parse(buffer); - assert(!result.isUninitialized()); + quiz_assert(!result.isUninitialized()); return result; } void assert_parsed_expression_type(const char * expression, Poincare::ExpressionNode::Type type) { Expression e = parse_expression(expression); - assert(e.type() == type); + quiz_assert(e.type() == type); } void assert_parsed_expression_is(const char * expression, Poincare::Expression r) { Expression e = parse_expression(expression); - assert(e.isIdenticalTo(r)); + quiz_assert(e.isIdenticalTo(r)); } void assert_parsed_expression_polynomial_degree(const char * expression, int degree, char symbolName) { GlobalContext globalContext; Expression e = parse_expression(expression); e = e.simplify(globalContext, Radian); - assert(e.polynomialDegree(symbolName) == degree); + quiz_assert(e.polynomialDegree(symbolName) == degree); } typedef Expression (*ProcessExpression)(Expression, Context & context, Preferences::AngleUnit angleUnit, Preferences::ComplexFormat complexFormat); @@ -87,7 +87,7 @@ void assert_parsed_expression_process_to(const char * expression, const char * r cout << "---- serialize to: " << buffer << " ----" << endl; cout << "----- compared to: " << result << " ----\n" << endl; #endif - assert(strcmp(buffer, result) == 0); + quiz_assert(strcmp(buffer, result) == 0); } template @@ -115,7 +115,7 @@ void assert_parsed_expression_serialize_to(Expression expression, const char * s #endif char buffer[500]; expression.serialize(buffer, sizeof(buffer), mode, numberOfSignifiantDigits); - assert(strcmp(buffer, serializedExpression) == 0); + quiz_assert(strcmp(buffer, serializedExpression) == 0); } #if 0 @@ -131,7 +131,7 @@ void assert_parsed_expression_layout_serialize_to_self(const char * expressionLa #if POINCARE_TESTS_PRINT_EXPRESSIONS cout << "---- serialized to: " << buffer << " ----\n" << endl; #endif - assert(strcmp(expressionLayout, buffer) == 0); + quiz_assert(strcmp(expressionLayout, buffer) == 0); delete e; delete el; } @@ -145,7 +145,7 @@ void assert_expression_layout_serialize_to(Poincare::ExpressionLayout * layout, cout << "---- serialized to: " << buffer << " ----" << endl; cout << "----- compared to: " << serialization << " ----\n" << endl; #endif - assert(strcmp(serialization, buffer) == 0); + quiz_assert(strcmp(serialization, buffer) == 0); } #endif diff --git a/poincare/test/identity.cpp b/poincare/test/identity.cpp index 1b3906360..63254a27b 100644 --- a/poincare/test/identity.cpp +++ b/poincare/test/identity.cpp @@ -3,34 +3,34 @@ #include "simplify_utils.h" QUIZ_CASE(poincare_identity_simple_term) { - assert(identical_to("1", "1")); - assert(!identical_to("1", "2")); + quiz_assert(identical_to("1", "1")); + quiz_assert(!identical_to("1", "2")); - assert(identical_to("A", "A")); - assert(!identical_to("A", "B")); + quiz_assert(identical_to("A", "A")); + quiz_assert(!identical_to("A", "B")); - assert(identical_to("1+2", "1+2")); - assert(!identical_to("1+2", "1+3")); + quiz_assert(identical_to("1+2", "1+2")); + quiz_assert(!identical_to("1+2", "1+3")); - assert(identical_to("1-2", "1-2")); - assert(!identical_to("1-2", "1-3")); + quiz_assert(identical_to("1-2", "1-2")); + quiz_assert(!identical_to("1-2", "1-3")); - assert(identical_to("1*2", "1*2")); - assert(!identical_to("1*2", "1*3")); + quiz_assert(identical_to("1*2", "1*2")); + quiz_assert(!identical_to("1*2", "1*3")); - assert(identical_to("1/2", "1/2")); - assert(!identical_to("1/2", "1/3")); + quiz_assert(identical_to("1/2", "1/2")); + quiz_assert(!identical_to("1/2", "1/3")); - assert(identical_to("1^2", "1^2")); - assert(!identical_to("1^2", "1^3")); + quiz_assert(identical_to("1^2", "1^2")); + quiz_assert(!identical_to("1^2", "1^3")); - assert(identical_to("cos(1)", "cos(1)")); - assert(!identical_to("cos(1)", "cos(2)")); + quiz_assert(identical_to("cos(1)", "cos(1)")); + quiz_assert(!identical_to("cos(1)", "cos(2)")); } QUIZ_CASE(poincare_identity_commutativity) { - assert(equivalent_to("1+2", "2+1")); - //assert(identical_to("1*2", "2*1")); - assert(!equivalent_to("1-2", "2-1")); - assert(!equivalent_to("1/2", "2/1")); + quiz_assert(equivalent_to("1+2", "2+1")); + //quiz_assert(identical_to("1*2", "2*1")); + quiz_assert(!equivalent_to("1-2", "2-1")); + quiz_assert(!equivalent_to("1/2", "2/1")); } diff --git a/poincare/test/integer.cpp b/poincare/test/integer.cpp index 6da97dec2..aebb8da66 100644 --- a/poincare/test/integer.cpp +++ b/poincare/test/integer.cpp @@ -26,18 +26,18 @@ QUIZ_CASE(poincare_integer_constructor) { } static inline void assert_equal(const Integer i, const Integer j) { - assert(Integer::NaturalOrder(i, j) == 0); + quiz_assert(Integer::NaturalOrder(i, j) == 0); } static inline void assert_not_equal(const Integer i, const Integer j) { - assert(Integer::NaturalOrder(i, j) != 0); + quiz_assert(Integer::NaturalOrder(i, j) != 0); } static inline void assert_lower(const Integer i, const Integer j) { - assert(Integer::NaturalOrder(i, j) < 0); + quiz_assert(Integer::NaturalOrder(i, j) < 0); } static inline void assert_greater(const Integer i, const Integer j) { - assert(Integer::NaturalOrder(i, j) > 0); + quiz_assert(Integer::NaturalOrder(i, j) > 0); } QUIZ_CASE(poincare_integer_compare) { @@ -59,31 +59,31 @@ QUIZ_CASE(poincare_integer_compare) { assert_lower(Integer("-1234567891234567892109209109"), Integer("123456789123456789")); assert_greater(Integer("123456789123456789"), Integer("123456789123456788")); assert_greater(Integer::Overflow(), Integer("123456789123456788")); - //FIXME: assert(Integer("0x2BABE") == Integer(178878)); - //FIXME: assert(Integer("0b1011") == Integer(11)); + //FIXME: quiz_assert(Integer("0x2BABE") == Integer(178878)); + //FIXME: quiz_assert(Integer("0b1011") == Integer(11)); } QUIZ_CASE(poincare_integer_properties) { - assert(Integer(0).isZero()); - assert(!Integer(-1).isZero()); - assert(!Integer(1).isZero()); - assert(Integer(1).isOne()); - assert(!Integer(-1).isOne()); - assert(!Integer(0).isOne()); - assert(OverflowedInteger().isInfinity()); // 2^32^k_maxNumberOfDigits - assert(!MaxInteger().isInfinity()); // 2^32^k_maxNumberOfDigits-1 - assert(!Integer(0).isInfinity()); - assert(Integer(8).isEven()); - assert(!Integer(7).isEven()); - assert(Integer(-8).isEven()); - assert(!Integer(-7).isEven()); - assert(!Integer(2).isNegative()); - assert(Integer(-2).isNegative()); - assert(Integer::NumberOfBase10Digits(MaxInteger()) == 309); + quiz_assert(Integer(0).isZero()); + quiz_assert(!Integer(-1).isZero()); + quiz_assert(!Integer(1).isZero()); + quiz_assert(Integer(1).isOne()); + quiz_assert(!Integer(-1).isOne()); + quiz_assert(!Integer(0).isOne()); + quiz_assert(OverflowedInteger().isInfinity()); // 2^32^k_maxNumberOfDigits + quiz_assert(!MaxInteger().isInfinity()); // 2^32^k_maxNumberOfDigits-1 + quiz_assert(!Integer(0).isInfinity()); + quiz_assert(Integer(8).isEven()); + quiz_assert(!Integer(7).isEven()); + quiz_assert(Integer(-8).isEven()); + quiz_assert(!Integer(-7).isEven()); + quiz_assert(!Integer(2).isNegative()); + quiz_assert(Integer(-2).isNegative()); + quiz_assert(Integer::NumberOfBase10Digits(MaxInteger()) == 309); } static inline void assert_add_to(const Integer i, const Integer j, const Integer k) { - assert(Integer::NaturalOrder(Integer::Addition(i, j), k) == 0); + quiz_assert(Integer::NaturalOrder(Integer::Addition(i, j), k) == 0); } QUIZ_CASE(poincare_integer_addition) { @@ -111,7 +111,7 @@ QUIZ_CASE(poincare_integer_addition) { } static inline void assert_sub_to(const Integer i, const Integer j, const Integer k) { - assert(Integer::NaturalOrder(Integer::Subtraction(i, j), k) == 0); + quiz_assert(Integer::NaturalOrder(Integer::Subtraction(i, j), k) == 0); } QUIZ_CASE(poincare_integer_subtraction) { @@ -145,7 +145,7 @@ QUIZ_CASE(poincare_integer_subtraction) { } static inline void assert_mult_to(const Integer i, const Integer j, const Integer k) { - assert(Integer::NaturalOrder(Integer::Multiplication(i, j), k) == 0); + quiz_assert(Integer::NaturalOrder(Integer::Multiplication(i, j), k) == 0); } QUIZ_CASE(poincare_integer_multiplication) { @@ -162,8 +162,8 @@ QUIZ_CASE(poincare_integer_multiplication) { } static inline void assert_div_to(const Integer i, const Integer j, const Integer q, const Integer r) { - assert(Integer::NaturalOrder(Integer::Division(i, j).quotient, q) == 0); - assert(Integer::NaturalOrder(Integer::Division(i, j).remainder, r) == 0); + quiz_assert(Integer::NaturalOrder(Integer::Division(i, j).quotient, q) == 0); + quiz_assert(Integer::NaturalOrder(Integer::Division(i, j).remainder, r) == 0); } QUIZ_CASE(poincare_integer_divide) { @@ -193,7 +193,7 @@ QUIZ_CASE(poincare_integer_divide) { } static inline void assert_pow_to(const Integer i, const Integer j, const Integer k) { - assert(Integer::NaturalOrder(Integer::Power(i, j), k) == 0); + quiz_assert(Integer::NaturalOrder(Integer::Power(i, j), k) == 0); } QUIZ_CASE(poincare_integer_pow) { @@ -202,7 +202,7 @@ QUIZ_CASE(poincare_integer_pow) { } static inline void assert_factorial_to(const Integer i, const Integer j) { - assert(Integer::NaturalOrder(Integer::Factorial(i), j) == 0); + quiz_assert(Integer::NaturalOrder(Integer::Factorial(i), j) == 0); } QUIZ_CASE(poincare_integer_factorial) { @@ -223,7 +223,7 @@ QUIZ_CASE(poincare_integer_simplify) { template void assert_integer_evals_to(const char * i, T result) { GlobalContext c; - assert(Integer(i).approximateToScalar(c, Preferences::AngleUnit::Radian) == result); + quiz_assert(Integer(i).approximateToScalar(c, Preferences::AngleUnit::Radian) == result); } QUIZ_CASE(poincare_integer_evaluate) { diff --git a/poincare/test/parentheses_layout.cpp b/poincare/test/parentheses_layout.cpp index e8a3849ff..1a68549e8 100644 --- a/poincare/test/parentheses_layout.cpp +++ b/poincare/test/parentheses_layout.cpp @@ -27,6 +27,6 @@ QUIZ_CASE(poincare_parenthesis_layout_size) { layout->addChildAtIndexInPlace(new CharLayout('6'), 5); layout->addChildAtIndexInPlace(rightPar, 7); layout->addChildAtIndexInPlace(new CharLayout('1'), 8); - assert(leftPar->size().height() == rightPar->size().height()); + quiz_assert(leftPar->size().height() == rightPar->size().height()); delete layout; } diff --git a/poincare/test/properties.cpp b/poincare/test/properties.cpp index 5d10db946..0bb019984 100644 --- a/poincare/test/properties.cpp +++ b/poincare/test/properties.cpp @@ -13,9 +13,9 @@ constexpr Poincare::ExpressionNode::Sign Unknown = Poincare::ExpressionNode::Sig void assert_parsed_expression_sign(const char * expression, Poincare::ExpressionNode::Sign sign) { GlobalContext globalContext; Expression e = parse_expression(expression); - assert(!e.isUninitialized()); + quiz_assert(!e.isUninitialized()); e = e.simplify(globalContext, Degree); - assert(e.sign() == sign); + quiz_assert(e.sign() == sign); } QUIZ_CASE(poincare_sign) { @@ -59,12 +59,12 @@ QUIZ_CASE(poincare_polynomial_degree) { void assert_parsed_expression_has_characteristic_range(const char * expression, float range, Preferences::AngleUnit angleUnit = Preferences::AngleUnit::Degree) { GlobalContext globalContext; Expression e = parse_expression(expression); - assert(!e.isUninitialized()); + quiz_assert(!e.isUninitialized()); e = e.simplify(globalContext, angleUnit); if (std::isnan(range)) { - assert(std::isnan(e.characteristicXRange(globalContext, angleUnit))); + quiz_assert(std::isnan(e.characteristicXRange(globalContext, angleUnit))); } else { - assert(std::fabs(e.characteristicXRange(globalContext, angleUnit) - range) < 0.0000001f); + quiz_assert(std::fabs(e.characteristicXRange(globalContext, angleUnit) - range) < 0.0000001f); } } @@ -84,16 +84,16 @@ QUIZ_CASE(poincare_characteristic_range) { void assert_parsed_expression_has_variables(const char * expression, const char * variables) { Expression e = parse_expression(expression); - assert(!e.isUninitialized()); + quiz_assert(!e.isUninitialized()); char variableBuffer[Expression::k_maxNumberOfVariables+1] = {0}; int numberOfVariables = e.getVariables(Poincare::Symbol::isVariableSymbol, variableBuffer); if (variables == nullptr) { - assert(numberOfVariables == -1); + quiz_assert(numberOfVariables == -1); } else { - assert(numberOfVariables == strlen(variables)); + quiz_assert(numberOfVariables == strlen(variables)); char * currentChar = variableBuffer; while (*variables != 0) { - assert(*currentChar++ == *variables++); + quiz_assert(*currentChar++ == *variables++); } } } @@ -110,18 +110,18 @@ QUIZ_CASE(poincare_get_variables) { void assert_parsed_expression_has_polynomial_coefficient(const char * expression, char symbolName, const char ** coefficients, Preferences::AngleUnit angleUnit = Preferences::AngleUnit::Degree) { GlobalContext globalContext; Expression e = parse_expression(expression); - assert(!e.isUninitialized()); + quiz_assert(!e.isUninitialized()); e = e.deepReduce(globalContext, angleUnit); Expression coefficientBuffer[Poincare::Expression::k_maxNumberOfPolynomialCoefficients]; int d = e.getPolynomialReducedCoefficients(symbolName, coefficientBuffer, globalContext, Radian); for (int i = 0; i <= d; i++) { Expression f = parse_expression(coefficients[i]); - assert(!f.isUninitialized()); + quiz_assert(!f.isUninitialized()); coefficientBuffer[i] = coefficientBuffer[i].deepReduce(globalContext, angleUnit); f = f.deepReduce(globalContext, angleUnit); - assert(coefficientBuffer[i].isIdenticalTo(f)); + quiz_assert(coefficientBuffer[i].isIdenticalTo(f)); } - assert(coefficients[d+1] == 0); + quiz_assert(coefficients[d+1] == 0); } QUIZ_CASE(poincare_get_polynomial_coefficients) { diff --git a/poincare/test/rational.cpp b/poincare/test/rational.cpp index cca3c90ce..05c887504 100644 --- a/poincare/test/rational.cpp +++ b/poincare/test/rational.cpp @@ -18,18 +18,18 @@ QUIZ_CASE(poincare_rational_constructor) { } static inline void assert_equal(const Rational i, const Rational j) { - assert(Rational::NaturalOrder(i, j) == 0); + quiz_assert(Rational::NaturalOrder(i, j) == 0); } static inline void assert_not_equal(const Rational i, const Rational j) { - assert(Rational::NaturalOrder(i, j) != 0); + quiz_assert(Rational::NaturalOrder(i, j) != 0); } static inline void assert_lower(const Rational i, const Rational j) { - assert(Rational::NaturalOrder(i, j) < 0); + quiz_assert(Rational::NaturalOrder(i, j) < 0); } static inline void assert_greater(const Rational i, const Rational j) { - assert(Rational::NaturalOrder(i, j) > 0); + quiz_assert(Rational::NaturalOrder(i, j) > 0); } QUIZ_CASE(poincare_rational_compare) { @@ -42,25 +42,25 @@ QUIZ_CASE(poincare_rational_compare) { } QUIZ_CASE(poincare_rational_properties) { - assert(Rational(-2).sign() == ExpressionNode::Sign::Negative); - assert(Rational(-2, 3).sign() == ExpressionNode::Sign::Negative); - assert(Rational(2, 3).sign() == ExpressionNode::Sign::Positive); - assert(Rational(0).isZero()); - assert(!Rational(231).isZero()); - assert(Rational(1).isOne()); - assert(!Rational(-1).isOne()); - assert(!Rational(1).isMinusOne()); - assert(Rational(-1).isMinusOne()); - assert(Rational(1,2).isHalf()); - assert(!Rational(-1).isHalf()); - assert(Rational(-1,2).isMinusHalf()); - assert(!Rational(3,2).isMinusHalf()); - assert(Rational(10).isTen()); - assert(!Rational(-1).isTen()); + quiz_assert(Rational(-2).sign() == ExpressionNode::Sign::Negative); + quiz_assert(Rational(-2, 3).sign() == ExpressionNode::Sign::Negative); + quiz_assert(Rational(2, 3).sign() == ExpressionNode::Sign::Positive); + quiz_assert(Rational(0).isZero()); + quiz_assert(!Rational(231).isZero()); + quiz_assert(Rational(1).isOne()); + quiz_assert(!Rational(-1).isOne()); + quiz_assert(!Rational(1).isMinusOne()); + quiz_assert(Rational(-1).isMinusOne()); + quiz_assert(Rational(1,2).isHalf()); + quiz_assert(!Rational(-1).isHalf()); + quiz_assert(Rational(-1,2).isMinusHalf()); + quiz_assert(!Rational(3,2).isMinusHalf()); + quiz_assert(Rational(10).isTen()); + quiz_assert(!Rational(-1).isTen()); } static inline void assert_add_to(const Rational i, const Rational j, const Rational k) { - assert(Rational::NaturalOrder(Rational::Addition(i, j), k) == 0); + quiz_assert(Rational::NaturalOrder(Rational::Addition(i, j), k) == 0); } QUIZ_CASE(poincare_rational_addition) { @@ -70,7 +70,7 @@ QUIZ_CASE(poincare_rational_addition) { } static inline void assert_pow_to(const Rational i,const Integer j, const Rational k) { - assert(Rational::NaturalOrder(Rational::IntegerPower(i, j), k) == 0); + quiz_assert(Rational::NaturalOrder(Rational::IntegerPower(i, j), k) == 0); } QUIZ_CASE(poincare_rational_power) {