TEST(rwDouble, stringstream){ // read and write a double std::stringstream sValue; double dIn = 0.000098; double dOut; sValue << dIn; sValue >> dOut; if(!sValue){ CHECK_FAIL("conversion failed"); } CHECK_DOUBLES_EQUAL(dIn, dOut, 0.0); }
TEST(rwFloat, stringstream){ // read and write a float std::stringstream sValue; float fIn = 0.00001; float fOut; sValue << fIn; if(!sValue){ CHECK_FAIL("conversion failed"); } sValue >> fOut; if(!sValue){ CHECK_FAIL("conversion failed"); } CHECK_DOUBLES_EQUAL(fIn, fOut, 0.0); }
TEST (Whatever,MyTest) { float fnum = 2.00001f; CHECK_DOUBLES_EQUAL (fnum, 2.0f); }