diff options
| author | Mike Buland <mike@xagasoft.com> | 2014-10-30 13:15:19 -0600 |
|---|---|---|
| committer | Mike Buland <mike@xagasoft.com> | 2014-10-30 13:15:19 -0600 |
| commit | 7026b96ec807b169f7b413056e52412ae422ea9d (patch) | |
| tree | 9a597b31b8c7d6a8781b45d1bbf27c258bb6a3a4 /src/unitnumber.cpp | |
| parent | 18a2be05bfacddcb7398f1b197bd1a5876c9a0cb (diff) | |
| download | clic-7026b96ec807b169f7b413056e52412ae422ea9d.tar.gz clic-7026b96ec807b169f7b413056e52412ae422ea9d.tar.bz2 clic-7026b96ec807b169f7b413056e52412ae422ea9d.tar.xz clic-7026b96ec807b169f7b413056e52412ae422ea9d.zip | |
The new division works great!
Other minor bug fixes including scale issues, digit() access stopped a
digit before the final possible digit in the scale, >, >=, <, <= all
work correctly with mixed scale numbers now, probably other fixes.
Diffstat (limited to 'src/unitnumber.cpp')
| -rw-r--r-- | src/unitnumber.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/unitnumber.cpp b/src/unitnumber.cpp index 1d63682..4846a07 100644 --- a/src/unitnumber.cpp +++ b/src/unitnumber.cpp | |||
| @@ -15,6 +15,8 @@ UnitNumber::UnitNumber() | |||
| 15 | "parse1", Bu::UnitSuite::expectPass ); | 15 | "parse1", Bu::UnitSuite::expectPass ); |
| 16 | add( static_cast<Bu::UnitSuite::Test>(&UnitNumber::multiply1), | 16 | add( static_cast<Bu::UnitSuite::Test>(&UnitNumber::multiply1), |
| 17 | "multiply1", Bu::UnitSuite::expectPass ); | 17 | "multiply1", Bu::UnitSuite::expectPass ); |
| 18 | add( static_cast<Bu::UnitSuite::Test>(&UnitNumber::divide1), | ||
| 19 | "divide1", Bu::UnitSuite::expectPass ); | ||
| 18 | add( static_cast<Bu::UnitSuite::Test>(&UnitNumber::number1), | 20 | add( static_cast<Bu::UnitSuite::Test>(&UnitNumber::number1), |
| 19 | "number1", Bu::UnitSuite::expectPass ); | 21 | "number1", Bu::UnitSuite::expectPass ); |
| 20 | add( static_cast<Bu::UnitSuite::Test>(&UnitNumber::compare1), | 22 | add( static_cast<Bu::UnitSuite::Test>(&UnitNumber::compare1), |
| @@ -68,6 +70,12 @@ void UnitNumber::multiply1() | |||
| 68 | ); | 70 | ); |
| 69 | } | 71 | } |
| 70 | 72 | ||
| 73 | void UnitNumber::divide1() | ||
| 74 | { | ||
| 75 | unitTest(Number("4") / Number("10") == "0"); | ||
| 76 | unitTest(Number("4") % Number("10") == "4"); | ||
| 77 | } | ||
| 78 | |||
| 71 | #define mathTest( anum, op, bnum, answ ) \ | 79 | #define mathTest( anum, op, bnum, answ ) \ |
| 72 | unitTest( (Number(anum) op Number(bnum)).toString() == answ ) | 80 | unitTest( (Number(anum) op Number(bnum)).toString() == answ ) |
| 73 | 81 | ||
