- Timestamp:
- Aug 30, 2006, 10:49:45 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/c++_tools/utility/utility.cc
r570 r609 38 38 std::stringstream ss(s); 39 39 double a; 40 return (ss>>a); 40 ss>>a; 41 if(ss.fail()) 42 return false; 43 // Check that nothing is left on stream 44 std::string b; 45 ss >> b; 46 return (b.size() ? false : true); 41 47 } 42 48 … … 45 51 std::stringstream ss(s); 46 52 float a; 47 return (ss>>a); 53 ss>>a; 54 if(ss.fail()) 55 return false; 56 // Check that nothing is left on stream 57 std::string b; 58 ss >> b; 59 return (b.size() ? false : true); 48 60 } 49 61 … … 52 64 std::stringstream ss(s); 53 65 int a; 54 return (ss>>a); 66 ss >> a; 67 if(ss.fail()) 68 return false; 69 // Check that nothing is left on stream 70 std::string b; 71 ss >> b; 72 return (b.size() ? false : true); 55 73 } 56 74 … … 61 79 ss >> s2; // to trim surrounding whitespaces 62 80 to_lower(s2); 81 // Check that nothing is left on stream 82 std::string s3; 83 ss >> s3; 84 if(s3.size()) 85 return false; 63 86 std::string nan("nan"); 64 87 return (nan==s2); -
trunk/test/Makefile.am
r605 r609 33 33 ncc_test nni_test pca_test regression_test rnd_test score_test \ 34 34 statistics_test stl_utility_test svd_test svm_test target_test \ 35 vector_test35 utility_test vector_test 36 36 37 37 check_PROGRAMS = $(TESTS) … … 67 67 svm_test_SOURCES = svm_test.cc 68 68 target_test_SOURCES = target_test.cc 69 utility_test_SOURCES = utility_test.cc 69 70 vector_test_SOURCES = vector_test.cc
Note: See TracChangeset
for help on using the changeset viewer.