1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
TEST(SerializeTest, basic)
{
std::stringstream stream;
int8_t check1 = -120;
int16_t check2 = -16666;
int32_t check3 = -12345678;
int64_t check4 = -8877665544332211;
uint8_t check5 = 120;
uint16_t check6 = 16666;
uint32_t check7 = 12345678;
uint64_t check8 = 8877665544332211;
float check9 = 66.5544332211;
double check0 = 66.5544332211;
std::string delim = "delim";
int8_t result1 = 0;
int16_t result2 = 0;
int32_t result3 = 0;
int64_t result4 = 0;
uint8_t result5 = 0;
uint16_t result6 = 0;
uint32_t result7 = 0;
uint64_t result8 = 0;
float result9 = 0;
double result0 = 0;
std::string string1;
std::string string2;
std::string string3;
stream << check1;
stream << check2;
stream << check3;
stream << check4;
stream << delim << std::string(";");
stream << check5;
stream << check6;
stream << check7;
stream << check8;
stream << delim << std::string(";");
stream << check9;
stream << check0;
stream << delim << std::string(";");
TFString(stream.tellg()).print();
stream >> result1;
stream >> result2;
stream >> result3;
stream >> result4;
std::getline(stream, string1, ';');
stream >> result5;;
stream >> result6;
stream >> result7;
stream >> result8;
std::getline(stream, string2, ';');
stream >> result9;
stream >> result0;
std::getline(stream, string3, ';');
CHECK_EQUAL(result1, check1);
CHECK_EQUAL(result2, check2);
CHECK_EQUAL(result3, check3);
LONGS_EQUAL(result4, check4);
CHECK_EQUAL(result5, check5);
CHECK_EQUAL(result6, check6);
CHECK_EQUAL(result7, check7);
LONGS_EQUAL(result8, check8);
DOUBLES_EQUAL(result9, check9, 0.1);
DOUBLES_EQUAL(result0, check0, 0.1);
STRCMP_EQUAL(delim.c_str(), string1.c_str());
STRCMP_EQUAL(delim.c_str(), string2.c_str());
STRCMP_EQUAL(delim.c_str(), string3.c_str());
}
|