diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-04-03 01:05:29 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-04-03 01:05:29 +0000 |
| commit | b0a5b7828239c8dd81fea3a13a6dffb1bfa88321 (patch) | |
| tree | b9d9d6d35d04322cf6f0ebcac0211d10ff423dee | |
| parent | 5f81afb39e9c05dd73a1c03a352601b34a8c5c58 (diff) | |
| download | libgats-b0a5b7828239c8dd81fea3a13a6dffb1bfa88321.tar.gz libgats-b0a5b7828239c8dd81fea3a13a6dffb1bfa88321.tar.bz2 libgats-b0a5b7828239c8dd81fea3a13a6dffb1bfa88321.tar.xz libgats-b0a5b7828239c8dd81fea3a13a6dffb1bfa88321.zip | |
Tweak to the float unit test.
| -rw-r--r-- | src/unit/float.unit | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/unit/float.unit b/src/unit/float.unit index 0473ffb..b1eb063 100644 --- a/src/unit/float.unit +++ b/src/unit/float.unit | |||
| @@ -33,7 +33,14 @@ suite Basic | |||
| 33 | unitTest( pObj != NULL ); | 33 | unitTest( pObj != NULL ); |
| 34 | unitTest( pObj->getType() == Gats::typeFloat ); | 34 | unitTest( pObj->getType() == Gats::typeFloat ); |
| 35 | Gats::Float *pFlt = dynamic_cast<Gats::Float *>(pObj); | 35 | Gats::Float *pFlt = dynamic_cast<Gats::Float *>(pObj); |
| 36 | // printf("In: %a\nOut: %a\n", dVal, pFlt->getValue() ); | 36 | Bu::String sHex; |
| 37 | for( Bu::String::iterator i = mb.getString().begin(); i; i++ ) | ||
| 38 | { | ||
| 39 | sHex += "0123456789abcdef"[(((uint8_t)*i)>>4)&0x0f]; | ||
| 40 | sHex += "0123456789abcdef"[(*i)&0x0f]; | ||
| 41 | sHex += ' '; | ||
| 42 | } | ||
| 43 | printf("In: %a\nOut: %a\nRaw: %s\n", dVal, pFlt->getValue(), sHex.getStr() ); | ||
| 37 | if( isnan( dVal ) ) | 44 | if( isnan( dVal ) ) |
| 38 | unitTest( isnan(pFlt->getValue()) == isnan(dVal) ); | 45 | unitTest( isnan(pFlt->getValue()) == isnan(dVal) ); |
| 39 | else | 46 | else |
| @@ -46,6 +53,7 @@ suite Basic | |||
| 46 | test positive | 53 | test positive |
| 47 | { | 54 | { |
| 48 | rw( 8485738457.0 ); | 55 | rw( 8485738457.0 ); |
| 56 | rw( 63723.0 ); | ||
| 49 | rw( 0.000000000000001928173 ); | 57 | rw( 0.000000000000001928173 ); |
| 50 | rw( 1.0 ); | 58 | rw( 1.0 ); |
| 51 | rw( 0.0 ); | 59 | rw( 0.0 ); |
| @@ -55,6 +63,7 @@ suite Basic | |||
| 55 | test negitave | 63 | test negitave |
| 56 | { | 64 | { |
| 57 | rw( -8485738457.0 ); | 65 | rw( -8485738457.0 ); |
| 66 | rw( -63723.0 ); | ||
| 58 | rw( -0.000000000000001928173 ); | 67 | rw( -0.000000000000001928173 ); |
| 59 | rw( -1.0 ); | 68 | rw( -1.0 ); |
| 60 | rw( -0.0 ); | 69 | rw( -0.0 ); |
