diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-15 20:30:14 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-15 20:30:14 +0000 |
commit | c2df35e6d042ed22c3b2babdc96817210742cb4b (patch) | |
tree | 28de4e74396b50aa929c360bb71ca940b26f1a89 /kbruch/testcases/ratio_test.cpp | |
parent | e91a687ea077784e22afb909503e7e3eab92a444 (diff) | |
download | tdeedu-c2df35e6d042ed22c3b2babdc96817210742cb4b.tar.gz tdeedu-c2df35e6d042ed22c3b2babdc96817210742cb4b.zip |
Fix some kdeedu build issues
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1236928 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbruch/testcases/ratio_test.cpp')
-rw-r--r-- | kbruch/testcases/ratio_test.cpp | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/kbruch/testcases/ratio_test.cpp b/kbruch/testcases/ratio_test.cpp index 0dac9dfe..bdc4419b 100644 --- a/kbruch/testcases/ratio_test.cpp +++ b/kbruch/testcases/ratio_test.cpp @@ -38,29 +38,29 @@ class ratio_test { // check basic initialisation ratio * ratio_a = new ratio(); - BOOST_RETQUIRE(ratio_a->numerator() == 0); - BOOST_RETQUIRE(ratio_a->denominator() == 1); + BOOST_REQUIRE(ratio_a->numerator() == 0); + BOOST_REQUIRE(ratio_a->denominator() == 1); // a denominator with value 0 is never allowed ratio * ratio_b = new ratio(2, 0); - BOOST_RETQUIRE(ratio_b->numerator() == 2); - BOOST_RETQUIRE(ratio_b->denominator() == 1); // division by zero not allowed + BOOST_REQUIRE(ratio_b->numerator() == 2); + BOOST_REQUIRE(ratio_b->denominator() == 1); // division by zero not allowed // a new ratio should always be reduced ratio * ratio_c = new ratio(2, 4); - BOOST_RETQUIRE(ratio_c->numerator() == 1); - BOOST_RETQUIRE(ratio_c->denominator() == 2); + BOOST_REQUIRE(ratio_c->numerator() == 1); + BOOST_REQUIRE(ratio_c->denominator() == 2); // check copy constructor ratio * ratio_d = new ratio(*ratio_c); - BOOST_RETQUIRE(ratio_d->numerator() == 1); - BOOST_RETQUIRE(ratio_d->denominator() == 2); + BOOST_REQUIRE(ratio_d->numerator() == 1); + BOOST_REQUIRE(ratio_d->denominator() == 2); // the copy constructor is not allowed to reduce the new ratio ratio_d->setNumerator(4, false); ratio * ratio_e = new ratio(*ratio_d); - BOOST_RETQUIRE(ratio_e->numerator() == 4); - BOOST_RETQUIRE(ratio_e->denominator() == 2); + BOOST_REQUIRE(ratio_e->numerator() == 4); + BOOST_REQUIRE(ratio_e->denominator() == 2); delete(ratio_a); delete(ratio_b); @@ -77,33 +77,33 @@ class ratio_test // check setNumerator() and numerator() (get) ratio * ratio_a = new ratio(); ratio_a->setNumerator(10); - BOOST_RETQUIRE(ratio_a->numerator() == 10); - BOOST_RETQUIRE(ratio_a->denominator() == 1); + BOOST_REQUIRE(ratio_a->numerator() == 10); + BOOST_REQUIRE(ratio_a->denominator() == 1); // check setDenominator() and denominator() (get) ratio_a->setDenominator(7); - BOOST_RETQUIRE(ratio_a->numerator() == 10); - BOOST_RETQUIRE(ratio_a->denominator() == 7); + BOOST_REQUIRE(ratio_a->numerator() == 10); + BOOST_REQUIRE(ratio_a->denominator() == 7); // now check if the ratio gets reduced ratio_a->setNumerator(14); - BOOST_RETQUIRE(ratio_a->numerator() == 2); - BOOST_RETQUIRE(ratio_a->denominator() == 1); + BOOST_REQUIRE(ratio_a->numerator() == 2); + BOOST_REQUIRE(ratio_a->denominator() == 1); // lets do the same, but with out reducing ratio_a->setNumerator(14, false); ratio_a->setDenominator(7, false); - BOOST_RETQUIRE(ratio_a->numerator() == 14); - BOOST_RETQUIRE(ratio_a->denominator() == 7); + BOOST_REQUIRE(ratio_a->numerator() == 14); + BOOST_REQUIRE(ratio_a->denominator() == 7); // now the = operator ratio * ratio_b = new ratio(); *ratio_b = *ratio_a; - BOOST_RETQUIRE(ratio_b->numerator() == 14); - BOOST_RETQUIRE(ratio_b->denominator() == 7); + BOOST_REQUIRE(ratio_b->numerator() == 14); + BOOST_REQUIRE(ratio_b->denominator() == 7); // make sure we didn't just copied the pointers - BOOST_RETQUIRE(ratio_a != ratio_b); + BOOST_REQUIRE(ratio_a != ratio_b); delete(ratio_a); delete(ratio_b); @@ -116,13 +116,13 @@ class ratio_test { ratio ratio_a; ratio_a = 8; - BOOST_RETQUIRE(ratio_a.numerator() == 8); - BOOST_RETQUIRE(ratio_a.denominator() == 1); + BOOST_REQUIRE(ratio_a.numerator() == 8); + BOOST_REQUIRE(ratio_a.denominator() == 1); ratio ratio_b(2, 3); ratio_a = ratio_b; - BOOST_RETQUIRE(ratio_a.numerator() == 2); - BOOST_RETQUIRE(ratio_a.denominator() == 3); + BOOST_REQUIRE(ratio_a.numerator() == 2); + BOOST_REQUIRE(ratio_a.denominator() == 3); return; } @@ -140,29 +140,29 @@ class ratio_test // check + operator ratio ratio_c = *ratio_a + *ratio_b; - BOOST_RETQUIRE(ratio_c.numerator() == 5); - BOOST_RETQUIRE(ratio_c.denominator() == 2); + BOOST_REQUIRE(ratio_c.numerator() == 5); + BOOST_REQUIRE(ratio_c.denominator() == 2); // it should be the same if we change the addends ratio_c = *ratio_b + *ratio_a; - BOOST_RETQUIRE(ratio_c.numerator() == 5); - BOOST_RETQUIRE(ratio_c.denominator() == 2); + BOOST_REQUIRE(ratio_c.numerator() == 5); + BOOST_REQUIRE(ratio_c.denominator() == 2); // check - operator ratio_c = *ratio_b - *ratio_a; - BOOST_RETQUIRE(ratio_c.numerator() == -3); - BOOST_RETQUIRE(ratio_c.denominator() == 2); + BOOST_REQUIRE(ratio_c.numerator() == -3); + BOOST_REQUIRE(ratio_c.denominator() == 2); // it should not be the same if we change the subtrahends ratio_c = *ratio_a - *ratio_b; - BOOST_RETQUIRE(ratio_c.numerator() == 3); - BOOST_RETQUIRE(ratio_c.denominator() == 2); + BOOST_REQUIRE(ratio_c.numerator() == 3); + BOOST_REQUIRE(ratio_c.denominator() == 2); // now check if we can get 0/1 *ratio_a = *ratio_b; ratio_c = *ratio_a - *ratio_b; - BOOST_RETQUIRE(ratio_c.numerator() == 0); - BOOST_RETQUIRE(ratio_c.denominator() == 1); + BOOST_REQUIRE(ratio_c.numerator() == 0); + BOOST_REQUIRE(ratio_c.denominator() == 1); delete(ratio_a); delete(ratio_b); @@ -183,32 +183,32 @@ class ratio_test // check * operator ratio ratio_c = *ratio_a * *ratio_b; - BOOST_RETQUIRE(ratio_c.numerator() == 1); - BOOST_RETQUIRE(ratio_c.denominator() == 2); + BOOST_REQUIRE(ratio_c.numerator() == 1); + BOOST_REQUIRE(ratio_c.denominator() == 2); // it should be the same if we change the addends ratio_c = *ratio_b * *ratio_a; - BOOST_RETQUIRE(ratio_c.numerator() == 1); - BOOST_RETQUIRE(ratio_c.denominator() == 2); + BOOST_REQUIRE(ratio_c.numerator() == 1); + BOOST_REQUIRE(ratio_c.denominator() == 2); // check / operator ratio_c = *ratio_b / *ratio_a; - BOOST_RETQUIRE(ratio_c.numerator() == 1); - BOOST_RETQUIRE(ratio_c.denominator() == 8); + BOOST_REQUIRE(ratio_c.numerator() == 1); + BOOST_REQUIRE(ratio_c.denominator() == 8); // it should not be the same if we change the subtrahends ratio_c = *ratio_a / *ratio_b; - BOOST_RETQUIRE(ratio_c.numerator() == 8); - BOOST_RETQUIRE(ratio_c.denominator() == 1); + BOOST_REQUIRE(ratio_c.numerator() == 8); + BOOST_REQUIRE(ratio_c.denominator() == 1); // now check if we can get 0/1 *ratio_a = 0; ratio_c = *ratio_a * *ratio_b; - BOOST_RETQUIRE(ratio_c.numerator() == 0); - BOOST_RETQUIRE(ratio_c.denominator() == 1); + BOOST_REQUIRE(ratio_c.numerator() == 0); + BOOST_REQUIRE(ratio_c.denominator() == 1); ratio_c = *ratio_a / *ratio_b; - BOOST_RETQUIRE(ratio_c.numerator() == 0); - BOOST_RETQUIRE(ratio_c.denominator() == 1); + BOOST_REQUIRE(ratio_c.numerator() == 0); + BOOST_REQUIRE(ratio_c.denominator() == 1); delete(ratio_a); delete(ratio_b); @@ -221,8 +221,8 @@ class ratio_test { ratio ratio_a(2, 3); ratio_a.reziproc(); - BOOST_RETQUIRE(ratio_a.numerator() == 3); - BOOST_RETQUIRE(ratio_a.denominator() == 2); + BOOST_REQUIRE(ratio_a.numerator() == 3); + BOOST_REQUIRE(ratio_a.denominator() == 2); return; } @@ -234,8 +234,8 @@ class ratio_test ratio_a.setNumerator(51, false); ratio_a.setDenominator(17, false); ratio_a.reduce(); - BOOST_RETQUIRE(ratio_a.numerator() == 3); - BOOST_RETQUIRE(ratio_a.denominator() == 1); + BOOST_REQUIRE(ratio_a.numerator() == 3); + BOOST_REQUIRE(ratio_a.denominator() == 1); return; } @@ -249,11 +249,11 @@ class ratio_test ratio ratio_d(2, -3); ratio ratio_e(-2, 3); - BOOST_RETQUIRE((ratio_a == ratio_a) == true); - BOOST_RETQUIRE((ratio_a == ratio_b) == true); - BOOST_RETQUIRE((ratio_a == ratio_c) == true); - BOOST_RETQUIRE((ratio_a == ratio_d) == false); - BOOST_RETQUIRE((ratio_a == ratio_e) == false); + BOOST_REQUIRE((ratio_a == ratio_a) == true); + BOOST_REQUIRE((ratio_a == ratio_b) == true); + BOOST_REQUIRE((ratio_a == ratio_c) == true); + BOOST_REQUIRE((ratio_a == ratio_d) == false); + BOOST_REQUIRE((ratio_a == ratio_e) == false); return; } @@ -267,21 +267,21 @@ class ratio_test ratio ratio_d(2, -3); ratio ratio_e(-2, 3); - BOOST_RETQUIRE((ratio_a < ratio_a) == false); - BOOST_RETQUIRE((ratio_a < ratio_b) == false); - BOOST_RETQUIRE((ratio_a < ratio_c) == false); - BOOST_RETQUIRE((ratio_a < ratio_d) == false); - BOOST_RETQUIRE((ratio_a < ratio_e) == false); + BOOST_REQUIRE((ratio_a < ratio_a) == false); + BOOST_REQUIRE((ratio_a < ratio_b) == false); + BOOST_REQUIRE((ratio_a < ratio_c) == false); + BOOST_REQUIRE((ratio_a < ratio_d) == false); + BOOST_REQUIRE((ratio_a < ratio_e) == false); ratio_a = ratio(-2, 3); - BOOST_RETQUIRE((ratio_a < ratio_a) == false); - BOOST_RETQUIRE((ratio_a < ratio_b) == true); - BOOST_RETQUIRE((ratio_a < ratio_c) == true); - BOOST_RETQUIRE((ratio_a < ratio_d) == false); - BOOST_RETQUIRE((ratio_a < ratio_e) == false); + BOOST_REQUIRE((ratio_a < ratio_a) == false); + BOOST_REQUIRE((ratio_a < ratio_b) == true); + BOOST_REQUIRE((ratio_a < ratio_c) == true); + BOOST_REQUIRE((ratio_a < ratio_d) == false); + BOOST_REQUIRE((ratio_a < ratio_e) == false); - BOOST_RETQUIRE((ratio(5, 8) < ratio(2, 1)) == true); + BOOST_REQUIRE((ratio(5, 8) < ratio(2, 1)) == true); return; } @@ -296,21 +296,21 @@ class ratio_test ratio ratio_e(-2, 3); ratio ratio_f(-4, 3); - BOOST_RETQUIRE((ratio_a > ratio_a) == false); - BOOST_RETQUIRE((ratio_a > ratio_b) == false); - BOOST_RETQUIRE((ratio_a > ratio_c) == false); - BOOST_RETQUIRE((ratio_a > ratio_d) == true); - BOOST_RETQUIRE((ratio_a > ratio_e) == true); - BOOST_RETQUIRE((ratio_a > ratio_f) == true); + BOOST_REQUIRE((ratio_a > ratio_a) == false); + BOOST_REQUIRE((ratio_a > ratio_b) == false); + BOOST_REQUIRE((ratio_a > ratio_c) == false); + BOOST_REQUIRE((ratio_a > ratio_d) == true); + BOOST_REQUIRE((ratio_a > ratio_e) == true); + BOOST_REQUIRE((ratio_a > ratio_f) == true); ratio_a = ratio(-2, 3); - BOOST_RETQUIRE((ratio_a > ratio_a) == false); - BOOST_RETQUIRE((ratio_a > ratio_b) == false); - BOOST_RETQUIRE((ratio_a > ratio_c) == false); - BOOST_RETQUIRE((ratio_a > ratio_d) == false); - BOOST_RETQUIRE((ratio_a > ratio_e) == false); - BOOST_RETQUIRE((ratio_a > ratio_f) == true); + BOOST_REQUIRE((ratio_a > ratio_a) == false); + BOOST_REQUIRE((ratio_a > ratio_b) == false); + BOOST_REQUIRE((ratio_a > ratio_c) == false); + BOOST_REQUIRE((ratio_a > ratio_d) == false); + BOOST_REQUIRE((ratio_a > ratio_e) == false); + BOOST_REQUIRE((ratio_a > ratio_f) == true); return; } |