CppUnitLite basic test approach confirmation
Hello, imagine the requirement is:
Use CppUnitLite and use stringstream instead of atoi and sprintf.
Write a test to read and write a double.
I did the below. Calling this from main, it prints:
*** STARTING TEST ** 1 tests, 0 failures, 0 errors
Can you please confirm this has accomplished the requirement? First time I am using CppUnitLite
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include "TestHarness.h"
#include <iostream>
TEST(toDouble, stringstream)
{
cout << "** STARTING TEST **";
std::stringstream dValue("32.1");
double value;
value = 32.1;
dValue >> value;
if (!dValue)
{
CHECK_FAIL("Failed")
}
CHECK_EQUAL(32.1, value);
}
|
Topic archived. No new replies allowed.