Changeset 649
- Timestamp:
- Jun 8, 2008, 4:46:28 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Stats.cc
r644 r649 266 266 ss >> rev; 267 267 ss >> count; 268 assert(rev<=revision_); 268 269 if (!count) 269 270 break; 270 if (rev+1 < static_cast<svn_revnum_t>(vec.size()) ) 271 vec.resize(rev+1); 271 vec.resize(std::max(vec.size(),static_cast<size_t>(rev+1))); 272 272 vec[rev]=count; 273 273 } … … 297 297 } 298 298 getline(is, str); 299 if (str!=cache_check_str()) 299 if (str!=cache_check_str()) { 300 300 return false; 301 } 301 302 for (size_t i=0; i<stats_.size(); ++i){ 302 303 load(is, stats_[i]); 303 304 getline(is, str); 304 if (str!=cache_check_str()) 305 if (str!=cache_check_str()) { 305 306 return false; 307 } 306 308 } 307 309 return true; -
trunk/test/stats_test.cc
r634 r649 38 38 #include <numeric> 39 39 #include <string> 40 #include <sstream> 40 41 #include <vector> 41 42 … … 50 51 bool test_classic(void); 51 52 bool test_base_class(const Stats&); 53 bool test_cache(const Stats&); 52 54 53 55 }} // end of namespace svndigest and theplu … … 110 112 111 113 114 bool test_cache(const Stats& stats) 115 { 116 std::stringstream out; 117 stats.print(out); 118 std::stringstream in(out.str()); 119 ClassicStats stats2(path()); 120 assert(in.good()); 121 if (!stats2.load_cache(in)){ 122 std::cout << "load_cache() failed\n"; 123 return false; 124 } 125 126 std::stringstream out2; 127 stats2.print(out2); 128 129 if (out.str()!=out2.str()) { 130 std::cout << "test_cache() failed\n"; 131 return false; 132 } 133 return true; 134 } 135 136 112 137 bool test_classic(void) 113 138 { … … 181 206 bool test_base_class(const Stats& s) 182 207 { 208 if (!test_cache(s)) 209 return false; 183 210 if (s.code()+s.comments()+s.empty()!=s.lines()){ 184 211 std::cerr << "Code plus comments plus empty do not add up to lines\n";
Note: See TracChangeset
for help on using the changeset viewer.