summaryrefslogtreecommitdiff
path: root/src/unitnumber.cpp
blob: 79797c9318b7fa207378cb16dc29077ca7554f98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "unitnumber.h"

#include "number.h"

UnitNumber::UnitNumber()
{
    setName("Number");
    add( static_cast<Bu::UnitSuite::Test>(&UnitNumber::parse1),
            "parse1", Bu::UnitSuite::expectPass );
    add( static_cast<Bu::UnitSuite::Test>(&UnitNumber::multiply1),
            "multiply1", Bu::UnitSuite::expectPass );
}

UnitNumber::~UnitNumber()
{
}

void UnitNumber::parse1()
{
    unitTest( Number("121932631356500531347203169112635269").toString() ==
        "121932631356500531347203169112635269" );
}

void UnitNumber::multiply1()
{
    unitTest(Number("123456789") * Number("987654321") == "121932631112635269");
    unitTest(
        Number("123456789123456789") * Number("987654321987654321") ==
            "121932631356500531347203169112635269"
        );
}