diff options
Diffstat (limited to 'src/unit/basic.unit')
| -rw-r--r-- | src/unit/basic.unit | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/unit/basic.unit b/src/unit/basic.unit index 744d679..d0309ee 100644 --- a/src/unit/basic.unit +++ b/src/unit/basic.unit | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include "bu/sio.h" | 18 | #include "bu/sio.h" |
| 19 | 19 | ||
| 20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
| 21 | #include <math.h> | ||
| 21 | 22 | ||
| 22 | using namespace Bu; | 23 | using namespace Bu; |
| 23 | 24 | ||
| @@ -120,6 +121,24 @@ suite Basic | |||
| 120 | } | 121 | } |
| 121 | } | 122 | } |
| 122 | 123 | ||
| 124 | test floats | ||
| 125 | { | ||
| 126 | Bu::MemBuf mb; | ||
| 127 | |||
| 128 | Gats::Float( M_PI ).write( mb ); | ||
| 129 | |||
| 130 | mb.setPos( 0 ); | ||
| 131 | |||
| 132 | Gats::Object *pObj = Gats::Object::read( mb ); | ||
| 133 | unitTest( pObj != NULL ); | ||
| 134 | unitTest( pObj->getType() == Gats::typeFloat ); | ||
| 135 | Gats::Float *pFlt = dynamic_cast<Gats::Float *>(pObj); | ||
| 136 | sio << "old = " << M_PI << ", new = " << pFlt->getValue() << sio.nl; | ||
| 137 | unitTest( pFlt->getValue() == M_PI ); | ||
| 138 | |||
| 139 | delete pObj; | ||
| 140 | } | ||
| 141 | |||
| 123 | test dictionary | 142 | test dictionary |
| 124 | { | 143 | { |
| 125 | MemBuf mb; | 144 | MemBuf mb; |
