Changeset 2248 for trunk/test/utility_test.cc
- Timestamp:
- Apr 22, 2010, 2:57:13 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/utility_test.cc
r2239 r2248 47 47 void test_errno_error_func(void); 48 48 void test_get_map(test::Suite&); 49 void test_load(test::Suite&); 49 50 void test_inverse(test::Suite&); 50 51 … … 170 171 test_errno_error(suite); 171 172 test_ptr_compare(suite); 173 test_load(suite); 172 174 173 175 return suite.return_value(); … … 233 235 if (!post_ok && prior_ok) 234 236 suite.err() << "test_less_nan failed\n"; 237 } 238 239 240 void test_load(test::Suite& suite) 241 { 242 std::istringstream iss(std::string("1.69 3.14")); 243 std::vector<double> double_vec; 244 utility::load(iss, double_vec); 245 suite.add(double_vec.size()==2); 246 247 std::istringstream iss2(std::string("1 2")); 248 std::vector<double> uint_vec; 249 utility::load(iss2, uint_vec); 250 suite.add(uint_vec.size()==2); 251 252 std::istringstream iss3(std::string("1.69 3.14")); 253 std::vector<std::string> str_vec; 254 utility::load(iss3, str_vec); 255 if (str_vec.size()==2) { 256 if (str_vec[1]!="3.14") { 257 suite.out() << "error: load<string>:" << "\n" 258 << " str_vec[1] = " << str_vec[1] << "\n" 259 << " expected: 3.14n"; 260 suite.add(false); 261 } 262 } 263 else { 264 suite.out() << "str_vec.size() is not 2\n"; 265 suite.add(false); 266 } 235 267 } 236 268
Note: See TracChangeset
for help on using the changeset viewer.