From 11b5a91c5884d496744911f261ed6c2b053b9940 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 19 Aug 2010 06:28:17 +0000 Subject: Wow, it pretty much all works. the float format is a little funny, I treat it as a string, with a string header and then string data that is then turned into a float. It's pretty much how it's going to work, unless I come up with something revolutionary. --- src/unit/basic.unit | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/unit/basic.unit') 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 @@ #include "bu/sio.h" #include +#include using namespace Bu; @@ -120,6 +121,24 @@ suite Basic } } + test floats + { + Bu::MemBuf mb; + + Gats::Float( M_PI ).write( mb ); + + mb.setPos( 0 ); + + Gats::Object *pObj = Gats::Object::read( mb ); + unitTest( pObj != NULL ); + unitTest( pObj->getType() == Gats::typeFloat ); + Gats::Float *pFlt = dynamic_cast(pObj); + sio << "old = " << M_PI << ", new = " << pFlt->getValue() << sio.nl; + unitTest( pFlt->getValue() == M_PI ); + + delete pObj; + } + test dictionary { MemBuf mb; -- cgit v1.2.3