From 9f138260dafeb5a1b541fff8dd577422439feb0b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 23 Apr 2013 10:25:26 -0600 Subject: Fixed random zeros bug. They weren't that random, the resize routine in PackedIntArray was written poorly. It was growing too much and computing the size of the original array incorrectly, so not all the data was being copied every time. --- src/unitnumber.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/unitnumber.cpp') diff --git a/src/unitnumber.cpp b/src/unitnumber.cpp index d4bc7a8..79797c9 100644 --- a/src/unitnumber.cpp +++ b/src/unitnumber.cpp @@ -5,6 +5,8 @@ UnitNumber::UnitNumber() { setName("Number"); + add( static_cast(&UnitNumber::parse1), + "parse1", Bu::UnitSuite::expectPass ); add( static_cast(&UnitNumber::multiply1), "multiply1", Bu::UnitSuite::expectPass ); } @@ -13,10 +15,18 @@ UnitNumber::~UnitNumber() { } +void UnitNumber::parse1() +{ + unitTest( Number("121932631356500531347203169112635269").toString() == + "121932631356500531347203169112635269" ); +} + void UnitNumber::multiply1() { + unitTest(Number("123456789") * Number("987654321") == "121932631112635269"); unitTest( - (Number("123456789123456789") * Number("987654321987654321")).toString() - == "121932631356500531347203169112635269" ); + Number("123456789123456789") * Number("987654321987654321") == + "121932631356500531347203169112635269" + ); } -- cgit v1.2.3