Changeset 9224 for code/branches/testing/test/util
- Timestamp:
- May 19, 2012, 3:03:02 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/testing/test/util/MultiTypeTest.cc
r9223 r9224 12 12 // x assignment(other) 13 13 14 // x set Value(value)15 // ? set Value(pointer)16 // x set Value<type>(value)14 // x set(value) 15 // ? set(pointer) 16 // x set<type>(value) 17 17 18 18 // x convert<type>() … … 26 26 // ? (pointer class) conversion 27 27 // x getValue(pointer) 28 // x get XXX()28 // x get<type>() 29 29 // ? getPointer() 30 30 … … 45 45 // Constructor // 46 46 ///////////////// 47 TEST(MultiType, ValueChar) { char value = -100; MultiType mt(value); EXPECT_TRUE(mt.isType<char>()); EXPECT_EQ(-100, mt.get Char()); }48 TEST(MultiType, ValueUnsignedChar) { unsigned char value = 255u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned char>()); EXPECT_EQ(255u, mt.get UnsignedChar()); }49 TEST(MultiType, ValueShort) { short value = -10000; MultiType mt(value); EXPECT_TRUE(mt.isType<short>()); EXPECT_EQ(-10000, mt.get Short()); }50 TEST(MultiType, ValueUnsignedShort) { unsigned short value = 65535u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned short>()); EXPECT_EQ(65535u, mt.get UnsignedShort()); }51 TEST(MultiType, ValueInt) { int value = -1000000000; MultiType mt(value); EXPECT_TRUE(mt.isType<int>()); EXPECT_EQ(-1000000000, mt.get Int()); }52 TEST(MultiType, ValueUnsignedInt) { unsigned int value = 4000000000u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned int>()); EXPECT_EQ(4000000000u, mt.get UnsignedInt()); }53 TEST(MultiType, ValueLong) { long value = -1000000000; MultiType mt(value); EXPECT_TRUE(mt.isType<long>()); EXPECT_EQ(-1000000000, mt.get Long()); }54 TEST(MultiType, ValueUnsignedLong) { unsigned long value = 4000000000u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned long>()); EXPECT_EQ(4000000000u, mt.get UnsignedLong()); }55 TEST(MultiType, ValueLongLong) { long long value = -1000000000000000000L; MultiType mt(value); EXPECT_TRUE(mt.isType<long long>()); EXPECT_EQ(-1000000000000000000L, mt.get LongLong()); }56 TEST(MultiType, ValueUnsignedLongLong) { unsigned long long value = 4000000000000000000UL; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned long long>()); EXPECT_EQ(4000000000000000000UL, mt.get UnsignedLongLong()); }57 TEST(MultiType, ValueFloat) { float value = 0.123456f; MultiType mt(value); EXPECT_TRUE(mt.isType<float>()); EXPECT_EQ(0.123456f, mt.get Float()); }58 TEST(MultiType, ValueDouble) { double value = 0.123456789; MultiType mt(value); EXPECT_TRUE(mt.isType<double>()); EXPECT_EQ(0.123456789, mt.get Double()); }59 TEST(MultiType, ValueLongDouble) { long double value = 0.123456789123456789; MultiType mt(value); EXPECT_TRUE(mt.isType<long double>()); EXPECT_EQ(0.123456789123456789, mt.get LongDouble()); }60 TEST(MultiType, ValueBool) { bool value = true; MultiType mt(value); EXPECT_TRUE(mt.isType<bool>()); EXPECT_EQ(true, mt.get Bool()); }61 TEST(MultiType, ValueVoidpointer) { int* pointer = new int; void* value = pointer; MultiType mt(value); EXPECT_TRUE(mt.isType<void*>()); EXPECT_EQ(value, mt.get Pointer<void>()); delete pointer; }62 TEST(MultiType, ValueString) { std::string value = "Hello World"; MultiType mt(value); EXPECT_TRUE(mt.isType<std::string>()); EXPECT_EQ("Hello World", mt.get String()); }63 TEST(MultiType, ValueVector2) { Vector2 value = Vector2(11, 22); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector2>()); EXPECT_EQ(Vector2(11, 22), mt.get Vector2()); }64 TEST(MultiType, ValueVector3) { Vector3 value = Vector3(11, 22, 33); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector3>()); EXPECT_EQ(Vector3(11, 22, 33), mt.get Vector3()); }65 TEST(MultiType, ValueVector4) { Vector4 value = Vector4(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector4>()); EXPECT_EQ(Vector4(11, 22, 33, 44), mt.get Vector4()); }66 TEST(MultiType, ValueColourValue) { ColourValue value = ColourValue(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<ColourValue>()); EXPECT_EQ(ColourValue(11, 22, 33, 44), mt.get ColourValue()); }67 TEST(MultiType, ValueQuaternion) { Quaternion value = Quaternion(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<Quaternion>()); EXPECT_EQ(Quaternion(11, 22, 33, 44), mt.get Quaternion()); }68 TEST(MultiType, ValueRadian) { Radian value = Radian(0.123); MultiType mt(value); EXPECT_TRUE(mt.isType<Radian>()); EXPECT_EQ(Radian(0.123), mt.get Radian()); }69 TEST(MultiType, ValueDegree) { Degree value = Degree(123); MultiType mt(value); EXPECT_TRUE(mt.isType<Degree>()); EXPECT_EQ(Degree(123), mt.get Degree()); }70 TEST(MultiType, ValueMbool) { mbool value = mbool(true); MultiType mt(value); EXPECT_TRUE(mt.isType<bool>()); EXPECT_EQ(mbool(true), mt.get Bool()); }71 TEST(MultiType, ValueCharPointer) { const char* value = "Hello World"; MultiType mt(value); EXPECT_TRUE(mt.isType<std::string>()); EXPECT_EQ("Hello World", mt.get String()); }47 TEST(MultiType, ValueChar) { char value = -100; MultiType mt(value); EXPECT_TRUE(mt.isType<char>()); EXPECT_EQ(-100, mt.get<char>()); } 48 TEST(MultiType, ValueUnsignedChar) { unsigned char value = 255u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned char>()); EXPECT_EQ(255u, mt.get<unsigned char>()); } 49 TEST(MultiType, ValueShort) { short value = -10000; MultiType mt(value); EXPECT_TRUE(mt.isType<short>()); EXPECT_EQ(-10000, mt.get<short>()); } 50 TEST(MultiType, ValueUnsignedShort) { unsigned short value = 65535u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned short>()); EXPECT_EQ(65535u, mt.get<unsigned short>()); } 51 TEST(MultiType, ValueInt) { int value = -1000000000; MultiType mt(value); EXPECT_TRUE(mt.isType<int>()); EXPECT_EQ(-1000000000, mt.get<int>()); } 52 TEST(MultiType, ValueUnsignedInt) { unsigned int value = 4000000000u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned int>()); EXPECT_EQ(4000000000u, mt.get<unsigned int>()); } 53 TEST(MultiType, ValueLong) { long value = -1000000000; MultiType mt(value); EXPECT_TRUE(mt.isType<long>()); EXPECT_EQ(-1000000000, mt.get<long>()); } 54 TEST(MultiType, ValueUnsignedLong) { unsigned long value = 4000000000u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned long>()); EXPECT_EQ(4000000000u, mt.get<unsigned long>()); } 55 TEST(MultiType, ValueLongLong) { long long value = -1000000000000000000L; MultiType mt(value); EXPECT_TRUE(mt.isType<long long>()); EXPECT_EQ(-1000000000000000000L, mt.get<long long>()); } 56 TEST(MultiType, ValueUnsignedLongLong) { unsigned long long value = 4000000000000000000UL; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned long long>()); EXPECT_EQ(4000000000000000000UL, mt.get<unsigned long long>()); } 57 TEST(MultiType, ValueFloat) { float value = 0.123456f; MultiType mt(value); EXPECT_TRUE(mt.isType<float>()); EXPECT_EQ(0.123456f, mt.get<float>()); } 58 TEST(MultiType, ValueDouble) { double value = 0.123456789; MultiType mt(value); EXPECT_TRUE(mt.isType<double>()); EXPECT_EQ(0.123456789, mt.get<double>()); } 59 TEST(MultiType, ValueLongDouble) { long double value = 0.123456789123456789; MultiType mt(value); EXPECT_TRUE(mt.isType<long double>()); EXPECT_EQ(0.123456789123456789, mt.get<long double>()); } 60 TEST(MultiType, ValueBool) { bool value = true; MultiType mt(value); EXPECT_TRUE(mt.isType<bool>()); EXPECT_EQ(true, mt.get<bool>()); } 61 TEST(MultiType, ValueVoidpointer) { int* pointer = new int; void* value = pointer; MultiType mt(value); EXPECT_TRUE(mt.isType<void*>()); EXPECT_EQ(value, mt.get<void*>()); delete pointer; } 62 TEST(MultiType, ValueString) { std::string value = "Hello World"; MultiType mt(value); EXPECT_TRUE(mt.isType<std::string>()); EXPECT_EQ("Hello World", mt.get<std::string>()); } 63 TEST(MultiType, ValueVector2) { Vector2 value = Vector2(11, 22); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector2>()); EXPECT_EQ(Vector2(11, 22), mt.get<Vector2>()); } 64 TEST(MultiType, ValueVector3) { Vector3 value = Vector3(11, 22, 33); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector3>()); EXPECT_EQ(Vector3(11, 22, 33), mt.get<Vector3>()); } 65 TEST(MultiType, ValueVector4) { Vector4 value = Vector4(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector4>()); EXPECT_EQ(Vector4(11, 22, 33, 44), mt.get<Vector4>()); } 66 TEST(MultiType, ValueColourValue) { ColourValue value = ColourValue(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<ColourValue>()); EXPECT_EQ(ColourValue(11, 22, 33, 44), mt.get<ColourValue>()); } 67 TEST(MultiType, ValueQuaternion) { Quaternion value = Quaternion(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<Quaternion>()); EXPECT_EQ(Quaternion(11, 22, 33, 44), mt.get<Quaternion>()); } 68 TEST(MultiType, ValueRadian) { Radian value = Radian(0.123); MultiType mt(value); EXPECT_TRUE(mt.isType<Radian>()); EXPECT_EQ(Radian(0.123), mt.get<Radian>()); } 69 TEST(MultiType, ValueDegree) { Degree value = Degree(123); MultiType mt(value); EXPECT_TRUE(mt.isType<Degree>()); EXPECT_EQ(Degree(123), mt.get<Degree>()); } 70 TEST(MultiType, ValueMbool) { mbool value = mbool(true); MultiType mt(value); EXPECT_TRUE(mt.isType<bool>()); EXPECT_EQ(mbool(true), mt.get<bool>()); } 71 TEST(MultiType, ValueCharPointer) { const char* value = "Hello World"; MultiType mt(value); EXPECT_TRUE(mt.isType<std::string>()); EXPECT_EQ("Hello World", mt.get<std::string>()); } 72 72 73 73 ////////////////////// … … 88 88 89 89 EXPECT_TRUE(mt2.isType<float>()); 90 EXPECT_EQ(0.1234f, mt2.get Float());90 EXPECT_EQ(0.1234f, mt2.get<float>()); 91 91 } 92 92 … … 104 104 EXPECT_FALSE(mt.null()); 105 105 EXPECT_TRUE(mt.isType<int>()); 106 EXPECT_EQ(55, mt.get Int());106 EXPECT_EQ(55, mt.get<int>()); 107 107 } 108 108 … … 112 112 113 113 EXPECT_TRUE(mt.isType<int>()); 114 EXPECT_EQ(66, mt.get Int());114 EXPECT_EQ(66, mt.get<int>()); 115 115 116 116 mt = 77.7f; // will be converted to int 117 117 118 118 EXPECT_TRUE(mt.isType<int>()); 119 EXPECT_EQ(77, mt.get Int());120 EXPECT_EQ(77.0f, mt.get Float());119 EXPECT_EQ(77, mt.get<int>()); 120 EXPECT_EQ(77.0f, mt.get<float>()); 121 121 } 122 122 … … 126 126 127 127 EXPECT_TRUE(mt.isType<float>()); 128 EXPECT_EQ(66, mt.get Int());129 EXPECT_EQ(66.6f, mt.get Float());128 EXPECT_EQ(66, mt.get<int>()); 129 EXPECT_EQ(66.6f, mt.get<float>()); 130 130 131 131 mt = 77.7f; 132 132 133 133 EXPECT_TRUE(mt.isType<float>()); 134 EXPECT_EQ(77, mt.get Int());135 EXPECT_EQ(77.7f, mt.get Float());134 EXPECT_EQ(77, mt.get<int>()); 135 EXPECT_EQ(77.7f, mt.get<float>()); 136 136 } 137 137 … … 141 141 142 142 EXPECT_TRUE(mt.isType<Vector3>()); 143 EXPECT_EQ(Vector3(1, 2, 3), mt.get Vector3());143 EXPECT_EQ(Vector3(1, 2, 3), mt.get<Vector3>()); 144 144 EXPECT_FALSE(mt.hasDefaultValue()); 145 145 … … 147 147 148 148 EXPECT_TRUE(mt.isType<Vector3>()); 149 EXPECT_EQ(Vector3::ZERO, mt.get Vector3());149 EXPECT_EQ(Vector3::ZERO, mt.get<Vector3>()); 150 150 EXPECT_TRUE(mt.hasDefaultValue()); 151 151 } … … 162 162 EXPECT_TRUE(mt2.isType<float>()); 163 163 164 EXPECT_EQ(33, mt1.get Int());165 EXPECT_EQ(33.0f, mt1.get Float());166 EXPECT_EQ(44.4f, mt2.get Float());164 EXPECT_EQ(33, mt1.get<int>()); 165 EXPECT_EQ(33.0f, mt1.get<float>()); 166 EXPECT_EQ(44.4f, mt2.get<float>()); 167 167 168 168 mt1 = mt2; … … 171 171 EXPECT_TRUE(mt2.isType<float>()); 172 172 173 EXPECT_EQ(44, mt1.get Int());174 EXPECT_EQ(44.0f, mt1.get Float());175 EXPECT_EQ(44.4f, mt2.get Float());176 } 177 178 //////////////// /////179 // set Value(value) //180 //////////////// /////173 EXPECT_EQ(44, mt1.get<int>()); 174 EXPECT_EQ(44.0f, mt1.get<float>()); 175 EXPECT_EQ(44.4f, mt2.get<float>()); 176 } 177 178 //////////////// 179 // set(value) // 180 //////////////// 181 181 TEST(MultiType, SetValueBoolToEmpty) 182 182 { 183 183 MultiType mt; 184 184 185 mt.set Value(true);185 mt.set(true); 186 186 187 187 EXPECT_TRUE(mt.isType<bool>()); 188 EXPECT_EQ(true, mt.get Bool());188 EXPECT_EQ(true, mt.get<bool>()); 189 189 } 190 190 … … 194 194 195 195 EXPECT_TRUE(mt.isType<std::string>()); 196 EXPECT_EQ("Hello", mt.get String());197 198 mt.set Value(1234);196 EXPECT_EQ("Hello", mt.get<std::string>()); 197 198 mt.set(1234); 199 199 200 200 EXPECT_TRUE(mt.isType<std::string>()); 201 EXPECT_EQ("1234", mt.get String());202 } 203 204 ////////////////////// /////205 // set Value<type>(value) //206 ////////////////////// /////201 EXPECT_EQ("1234", mt.get<std::string>()); 202 } 203 204 ////////////////////// 205 // set<type>(value) // 206 ////////////////////// 207 207 TEST(MultiType, SetValueWithTypeIntToString) 208 208 { … … 210 210 211 211 EXPECT_TRUE(mt.isType<std::string>()); 212 EXPECT_EQ("Hello", mt.get String());213 214 mt.set Value<int>(1234);215 216 EXPECT_TRUE(mt.isType<int>()); 217 EXPECT_EQ(1234, mt.get Int());212 EXPECT_EQ("Hello", mt.get<std::string>()); 213 214 mt.set<int>(1234); 215 216 EXPECT_TRUE(mt.isType<int>()); 217 EXPECT_EQ(1234, mt.get<int>()); 218 218 } 219 219 … … 223 223 224 224 EXPECT_TRUE(mt.isType<std::string>()); 225 EXPECT_EQ("Hello", mt.get String());226 227 mt.set Value<int>("1234");228 229 EXPECT_TRUE(mt.isType<int>()); 230 EXPECT_EQ(1234, mt.get Int());225 EXPECT_EQ("Hello", mt.get<std::string>()); 226 227 mt.set<int>("1234"); 228 229 EXPECT_TRUE(mt.isType<int>()); 230 EXPECT_EQ(1234, mt.get<int>()); 231 231 } 232 232 … … 236 236 237 237 EXPECT_TRUE(mt.isType<int>()); 238 EXPECT_EQ(4321, mt.get Int());239 240 mt.set Value<int>(1234);241 242 EXPECT_TRUE(mt.isType<int>()); 243 EXPECT_EQ(1234, mt.get Int());238 EXPECT_EQ(4321, mt.get<int>()); 239 240 mt.set<int>(1234); 241 242 EXPECT_TRUE(mt.isType<int>()); 243 EXPECT_EQ(1234, mt.get<int>()); 244 244 } 245 245 … … 253 253 254 254 EXPECT_TRUE(mt.isType<int>()); 255 EXPECT_EQ(0, mt.get Int());255 EXPECT_EQ(0, mt.get<int>()); 256 256 257 257 // EXPECT_TRUE(mt.hasDefaultValue()); … … 263 263 264 264 EXPECT_TRUE(mt.isType<float>()); 265 EXPECT_EQ(1.234f, mt.get Float());266 EXPECT_EQ(1, mt.get Int());265 EXPECT_EQ(1.234f, mt.get<float>()); 266 EXPECT_EQ(1, mt.get<int>()); 267 267 268 268 mt.convert<int>(); 269 269 270 270 EXPECT_TRUE(mt.isType<int>()); 271 EXPECT_EQ(1.0f, mt.get Float());272 EXPECT_EQ(1, mt.get Int());271 EXPECT_EQ(1.0f, mt.get<float>()); 272 EXPECT_EQ(1, mt.get<int>()); 273 273 } 274 274 … … 278 278 279 279 EXPECT_TRUE(mt.isType<float>()); 280 EXPECT_EQ(1.234f, mt.get Float());281 EXPECT_EQ(Vector3::ZERO, mt.get Vector3());280 EXPECT_EQ(1.234f, mt.get<float>()); 281 EXPECT_EQ(Vector3::ZERO, mt.get<Vector3>()); 282 282 283 283 mt.convert<Vector3>(); 284 284 285 285 EXPECT_TRUE(mt.isType<Vector3>()); 286 EXPECT_EQ(0.0f, mt.get Float());287 EXPECT_EQ(Vector3::ZERO, mt.get Vector3());286 EXPECT_EQ(0.0f, mt.get<float>()); 287 EXPECT_EQ(Vector3::ZERO, mt.get<Vector3>()); 288 288 289 289 // EXPECT_TRUE(mt.hasDefaultValue()); … … 300 300 EXPECT_FALSE(mt.isType<void>()); 301 301 EXPECT_FALSE(mt.null()); 302 EXPECT_EQ(10, mt.get Int());302 EXPECT_EQ(10, mt.get<int>()); 303 303 304 304 mt.reset(); … … 307 307 EXPECT_TRUE(mt.isType<void>()); 308 308 EXPECT_TRUE(mt.null()); 309 EXPECT_EQ(0, mt.get Int());309 EXPECT_EQ(0, mt.get<int>()); 310 310 } 311 311 … … 319 319 EXPECT_TRUE(mt.isType<int>()); 320 320 EXPECT_FALSE(mt.isType<float>()); 321 EXPECT_EQ(10, mt.get Int());321 EXPECT_EQ(10, mt.get<int>()); 322 322 323 323 mt.reset<float>(); … … 325 325 EXPECT_FALSE(mt.isType<int>()); 326 326 EXPECT_TRUE(mt.isType<float>()); 327 EXPECT_EQ(0, mt.get Int());327 EXPECT_EQ(0, mt.get<int>()); 328 328 } 329 329 … … 336 336 337 337 EXPECT_TRUE(mt.isType<int>()); 338 EXPECT_EQ(10, mt.get Int());338 EXPECT_EQ(10, mt.get<int>()); 339 339 340 340 mt.resetValue(); 341 341 342 342 EXPECT_TRUE(mt.isType<int>()); 343 EXPECT_EQ(0, mt.get Int());343 EXPECT_EQ(0, mt.get<int>()); 344 344 } 345 345 … … 430 430 431 431 ////////////// 432 // get XXX() //432 // get<type>() // 433 433 ////////////// 434 434 TEST(MultiType, GetValueFromInt) … … 436 436 MultiType mt(256); 437 437 438 EXPECT_EQ(0, mt.get Char());439 EXPECT_EQ(0u, mt.get UnsignedChar());440 EXPECT_EQ(256, mt.get Short());441 EXPECT_EQ(256u, mt.get UnsignedShort());442 EXPECT_EQ(256, mt.get Int());443 EXPECT_EQ(256u, mt.get UnsignedInt());444 EXPECT_EQ(256, mt.get Long());445 EXPECT_EQ(256u, mt.get UnsignedLong());446 EXPECT_EQ(256, mt.get LongLong());447 EXPECT_EQ(256u, mt.get UnsignedLongLong());448 EXPECT_EQ(256.0f, mt.get Float());449 EXPECT_EQ(256.0, mt.get Double());450 EXPECT_EQ(256.0, mt.get LongDouble());451 EXPECT_TRUE(mt.get Bool());452 EXPECT_EQ("256", mt.get String());438 EXPECT_EQ(0, mt.get<char>()); 439 EXPECT_EQ(0u, mt.get<unsigned char>()); 440 EXPECT_EQ(256, mt.get<short>()); 441 EXPECT_EQ(256u, mt.get<unsigned short>()); 442 EXPECT_EQ(256, mt.get<int>()); 443 EXPECT_EQ(256u, mt.get<unsigned int>()); 444 EXPECT_EQ(256, mt.get<long>()); 445 EXPECT_EQ(256u, mt.get<unsigned long>()); 446 EXPECT_EQ(256, mt.get<long long>()); 447 EXPECT_EQ(256u, mt.get<unsigned long long>()); 448 EXPECT_EQ(256.0f, mt.get<float>()); 449 EXPECT_EQ(256.0, mt.get<double>()); 450 EXPECT_EQ(256.0, mt.get<long double>()); 451 EXPECT_TRUE(mt.get<bool>()); 452 EXPECT_EQ("256", mt.get<std::string>()); 453 453 } 454 454 … … 457 457 MultiType mt(128.821); 458 458 459 EXPECT_EQ(-128, mt.get Char());460 EXPECT_EQ(128u, mt.get UnsignedChar());461 EXPECT_EQ(128, mt.get Short());462 EXPECT_EQ(128u, mt.get UnsignedShort());463 EXPECT_EQ(128, mt.get Int());464 EXPECT_EQ(128u, mt.get UnsignedInt());465 EXPECT_EQ(128, mt.get Long());466 EXPECT_EQ(128u, mt.get UnsignedLong());467 EXPECT_EQ(128, mt.get LongLong());468 EXPECT_EQ(128u, mt.get UnsignedLongLong());469 EXPECT_EQ(128.821f, mt.get Float());470 EXPECT_EQ(128.821, mt.get Double());471 EXPECT_EQ(128.821, mt.get LongDouble());472 EXPECT_TRUE(mt.get Bool());473 EXPECT_EQ("128.821", mt.get String());459 EXPECT_EQ(-128, mt.get<char>()); 460 EXPECT_EQ(128u, mt.get<unsigned char>()); 461 EXPECT_EQ(128, mt.get<short>()); 462 EXPECT_EQ(128u, mt.get<unsigned short>()); 463 EXPECT_EQ(128, mt.get<int>()); 464 EXPECT_EQ(128u, mt.get<unsigned int>()); 465 EXPECT_EQ(128, mt.get<long>()); 466 EXPECT_EQ(128u, mt.get<unsigned long>()); 467 EXPECT_EQ(128, mt.get<long long>()); 468 EXPECT_EQ(128u, mt.get<unsigned long long>()); 469 EXPECT_EQ(128.821f, mt.get<float>()); 470 EXPECT_EQ(128.821, mt.get<double>()); 471 EXPECT_EQ(128.821, mt.get<long double>()); 472 EXPECT_TRUE(mt.get<bool>()); 473 EXPECT_EQ("128.821", mt.get<std::string>()); 474 474 } 475 475 … … 478 478 MultiType mt("0.123"); 479 479 480 EXPECT_EQ('0', mt.get Char());481 EXPECT_EQ('0', mt.get UnsignedChar());482 EXPECT_EQ(0, mt.get Short());483 EXPECT_EQ(0u, mt.get UnsignedShort());484 EXPECT_EQ(0, mt.get Int());485 EXPECT_EQ(0u, mt.get UnsignedInt());486 EXPECT_EQ(0, mt.get Long());487 EXPECT_EQ(0u, mt.get UnsignedLong());488 EXPECT_EQ(0, mt.get LongLong());489 EXPECT_EQ(0u, mt.get UnsignedLongLong());490 EXPECT_EQ(0.123f, mt.get Float());491 EXPECT_EQ(0.123, mt.get Double());492 EXPECT_DOUBLE_EQ(0.123, mt.get LongDouble());493 EXPECT_FALSE(mt.get Bool());494 EXPECT_EQ("0.123", mt.get String());480 EXPECT_EQ('0', mt.get<char>()); 481 EXPECT_EQ('0', mt.get<unsigned char>()); 482 EXPECT_EQ(0, mt.get<short>()); 483 EXPECT_EQ(0u, mt.get<unsigned short>()); 484 EXPECT_EQ(0, mt.get<int>()); 485 EXPECT_EQ(0u, mt.get<unsigned int>()); 486 EXPECT_EQ(0, mt.get<long>()); 487 EXPECT_EQ(0u, mt.get<unsigned long>()); 488 EXPECT_EQ(0, mt.get<long long>()); 489 EXPECT_EQ(0u, mt.get<unsigned long long>()); 490 EXPECT_EQ(0.123f, mt.get<float>()); 491 EXPECT_EQ(0.123, mt.get<double>()); 492 EXPECT_DOUBLE_EQ(0.123, mt.get<long double>()); 493 EXPECT_FALSE(mt.get<bool>()); 494 EXPECT_EQ("0.123", mt.get<std::string>()); 495 495 } 496 496
Note: See TracChangeset
for help on using the changeset viewer.