clean up tests

This commit is contained in:
Tobias Berger 2021-09-21 11:51:22 +02:00
parent 8c76b04b39
commit dff795a669

View file

@ -223,7 +223,6 @@ void FractionTest::test_division() {
QCOMPARE(f1 / 2, f2); QCOMPARE(f1 / 2, f2);
f1 /= 2; f1 /= 2;
qDebug() << f1.display();
QCOMPARE(f1, 0.5); QCOMPARE(f1, 0.5);
QCOMPARE(f1 / 2, 0.25); QCOMPARE(f1 / 2, 0.25);
@ -466,21 +465,21 @@ void FractionTest::test_pow() {
// x ** 0 = 1; (where x != 0 and x ∈ R) // x ** 0 = 1; (where x != 0 and x ∈ R)
// 0 ** 0 depends on context // 0 ** 0 depends on context
QCOMPARE(f1.pow(0), 1.0); QCOMPARE(f1.pow(0), 1.0);
bool threw_correct_error = false; bool threw_not_defined_error = false;
try { try {
Fraction(0, 2).pow(0); Fraction(0, 2).pow(0);
} catch (const not_defined_error&) { } catch (const not_defined_error&) {
threw_correct_error = true; threw_not_defined_error = true;
} }
QVERIFY(threw_correct_error); QVERIFY(threw_not_defined_error);
threw_correct_error = false; bool threw_not_real_error = false;
try { try {
Fraction(0, 1).pow(-1); Fraction(0, 1).pow(-1);
} catch (const not_real_error&) { } catch (const not_real_error&) {
threw_correct_error = true; threw_not_real_error = true;
} }
QVERIFY(threw_correct_error); QVERIFY(threw_not_real_error);
} }
QTEST_APPLESS_MAIN(FractionTest) QTEST_APPLESS_MAIN(FractionTest)