- Timestamp:
- May 9, 2008, 2:34:22 AM (14 years ago)
- Location:
- trunk/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Makefile.am
r624 r633 71 71 copyright_test_DEPENDENCIES = $(toy_project) @top_builddir@/lib/libsvndigest.la 72 72 73 @top_builddir@/lib/libsvndigest.la: 74 @cd @top_builddir@/lib/ && $(MAKE) $(AM_MAKEFLAGS); 75 73 76 $(toy_project): 74 77 echo Checking out test repository && \ … … 77 80 clean-local: 78 81 rm -rf *.png *.tmp *~ $(targetdir) 82 83 .PHONY: @top_builddir@/lib/libsvndigest.la -
trunk/test/stats_test.cc
r604 r633 37 37 #include <iostream> 38 38 #include <numeric> 39 #include <sstream> 39 40 #include <string> 40 41 #include <vector> … … 48 49 bool test_add(void); 49 50 bool test_blame(void); 51 bool test_cache(const Stats&); 50 52 bool test_classic(void); 51 53 bool test_base_class(const Stats&); … … 67 69 } 68 70 69 ok &= test_add();70 ok &= test_blame();71 // ok &= test_add(); 72 //ok &= test_blame(); 71 73 ok &= test_classic(); 72 74 … … 110 112 111 113 114 bool test_cache(const Stats& stats) 115 { 116 std::cerr << "test cache " << std::endl; 117 std::stringstream ss; 118 stats.print(ss); 119 ClassicStats new_stats(path()); 120 if (!new_stats.load_cache(ss)) { 121 std::cerr << "Failed reloading cache" << std::endl; 122 return false; 123 } 124 std::cerr << "Hello" << std::endl; 125 ss.clear(std::ios::goodbit); 126 if (stats.authors() != new_stats.authors()) { 127 std::cerr << "Error: cache: authors not the same\n"; 128 return false; 129 } 130 std::cerr << "Hello2" << std::endl; 131 if (stats.revision()!=new_stats.revision()) { 132 std::cerr << "Error: cache: revision not the same\n"; 133 return false; 134 } 135 try { 136 for (int lt=0; lt<1; ++lt) { 137 for (std::set<std::string>::const_iterator a=stats.authors().begin(); 138 a!=stats.authors().end(); ++a) { 139 for (svn_revnum_t rev=0; rev<=stats.revision(); ++rev) { 140 std::cerr << "lt: " << lt << std::endl; 141 std::cerr << "author: " << *a << std::endl; 142 std::cerr << "rev: " << rev << std::endl; 143 if (stats(lt, *a, rev)!=new_stats(lt, *a, rev)) { 144 std::cerr << "Error cache:\n"; 145 std::cerr << "lt: " << lt << std::endl; 146 std::cerr << "author: " << *a << std::endl; 147 std::cerr << "rev: " << rev << std::endl; 148 std::cerr << stats(lt, *a, rev) << " not equal " 149 << new_stats(lt, *a, rev) << std::endl; 150 return false; 151 } 152 } 153 } 154 } 155 } 156 catch (std::runtime_error& e) { 157 std::cerr << "Caught an exception. what(): " << e.what() << "\n"; 158 return false; 159 } 160 161 std::stringstream ss2; 162 new_stats.print(ss2); 163 if (ss.str()!=ss2.str()) { 164 std::cerr << "ERROR: reprinted cache not equal first printed cache\n"; 165 166 std::string line; 167 std::string line2; 168 std::size_t line_no=1; 169 ss.seekg(0); 170 ss2.seekg(0); 171 assert(ss.good()); 172 assert(ss2.good()); 173 while (getline(ss, line) && getline(ss2, line2) ) { 174 if (line==line2) { 175 std::cerr << line_no << " " << line << "\n"; 176 } 177 else { 178 std::cerr << line_no << "< " << line << "\n"; 179 std::cerr << line_no << "> " << line2 << "\n"; 180 return false; 181 } 182 ++line_no; 183 } 184 return false; 185 } 186 return true; 187 } 188 189 112 190 bool test_classic(void) 113 191 { … … 115 193 ClassicStats cs(path()); 116 194 cs.parse(path()); 117 ok &= test_base_class(cs); 195 //ok &= test_base_class(cs); 196 197 // Peter, should be included in test_base_test() 198 ok &= test_cache(cs); 118 199 119 200 // testing copyright lines for peter
Note: See TracChangeset
for help on using the changeset viewer.