Changeset 1162
- Timestamp:
- Aug 13, 2010, 7:30:03 PM (13 years ago)
- Location:
- trunk/test
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Suite.cc
r1119 r1162 56 56 if (!have_test_repo) { 57 57 out() << "Skipping test because test repository is not available\n"; 58 exit (77);58 ::exit (77); 59 59 } 60 60 update_test_wc(); … … 73 73 ok_ = ok_ && b; 74 74 return b; 75 } 76 77 78 int Suite::exit_status(void) const 79 { 80 int value = EXIT_FAILURE; 81 if (ok()) { 82 value = EXIT_SUCCESS; 83 } 84 out() << "exit status: " << value << "\n"; 85 return value; 75 86 } 76 87 -
trunk/test/Suite.h
r1044 r1162 49 49 50 50 /** 51 \return EXIT_FAILURE or EXIT_SUCCESS depending on ok() 52 */ 53 int exit_status(void) const; 54 55 /** 51 56 \return true if all tests are OK 52 57 */ -
trunk/test/cache_partial_test.cc
r1124 r1162 83 83 is.close(); 84 84 85 if (suite.ok()) { 86 suite.out() << "Test is OK\n"; 87 return 0; 88 } 89 suite.out() << "Test failed\n"; 90 return 1; 85 return suite.exit_status(); 91 86 } 92 87 -
trunk/test/color_test.cc
r1127 r1162 21 21 */ 22 22 23 #include "Suite.h" 24 23 25 #include "lib/Colors.h" 24 26 … … 29 31 { 30 32 using namespace theplu::svndigest; 31 bool ok=true;33 test::Suite suite(argc, argv); 32 34 33 35 // The loop adds new authors to the author color map until all … … 48 50 // Test first and last color, expected to be the same. 49 51 if (r!=r_first || g!=g_first || b!=b_first) { 50 ok=false;52 suite.add(false); 51 53 std::cerr << "Expected r,g,b " 52 54 << static_cast<int>(r_first) << ',' … … 59 61 } 60 62 61 if (ok) 62 return 0; 63 return -1; 63 64 return suite.exit_status(); 64 65 } -
trunk/test/config_test.cc
r1152 r1162 42 42 test_props(suite); 43 43 44 if (suite.ok()) { 45 suite.out() << "Test is Ok!" << std::endl; 46 return 0; 47 } 48 suite.out() << "Test failed." << std::endl; 49 return 1; 44 return suite.exit_status(); 50 45 } 51 46 -
trunk/test/copyright_test.cc
r1119 r1162 126 126 os.close(); 127 127 128 if (suite.ok()) { 129 suite.out() << "Test is Ok!" << std::endl; 130 return 0; 131 } 132 suite.out() << "Test failed." << std::endl; 133 return 1; 128 return suite.exit_status(); 134 129 } 135 130 -
trunk/test/date_test.cc
r1127 r1162 21 21 */ 22 22 23 #include "Suite.h" 24 23 25 #include "lib/Date.h" 24 26 … … 26 28 #include <string> 27 29 28 int main( const int argc,constchar* argv[])30 int main(int argc, char* argv[]) 29 31 { 30 32 using namespace theplu::svndigest; 31 bool ok=true;33 test::Suite suite(argc, argv); 32 34 33 35 Date date("2007-06-27T15:40:52.123456Z"); 34 36 if (date("%H:%M")!="15:40"){ 35 ok = false;37 suite.add(false); 36 38 std::cerr << "date(\"%H:%M\") returns: " << date("%H:%M") 37 39 << "\nexpected '15:40'" << std::endl; 38 40 } 39 41 40 if (ok) 41 return 0; 42 return -1; 42 return suite.exit_status(); 43 43 } 44 44 -
trunk/test/htmlstream_test.cc
r1127 r1162 39 39 test_stream("&", "&", suite); 40 40 41 if (suite.ok()) 42 return 0; 43 return 1; 41 return suite.exit_status(); 44 42 } 45 43 -
trunk/test/parser_test.cc
r1127 r1162 22 22 */ 23 23 24 #include "Suite.h" 25 24 26 #include "lib/LineTypeParser.h" 25 27 … … 29 31 bool test(const std::string&, std::ostream&); 30 32 31 int main(const int argc,const char* argv[]) 33 34 int main(int argc, char* argv[]) 32 35 { 36 theplu::svndigest::test::Suite suite(argc, argv); 33 37 bool ok=true; 34 38 std::ofstream os("parser.tmp"); 35 ok = ok && test("parser.cc",os);36 ok = ok && test("Makefile.am",os);37 ok = ok && test("../INSTALL",os);38 return 0;39 suite.add(test("parser.cc",os)); 40 suite.add(test("Makefile.am",os)); 41 suite.add(test("../INSTALL",os)); 42 return suite.exit_status(); 39 43 } 40 44 -
trunk/test/stats_test.cc
r1124 r1162 62 62 63 63 bool verbose=suite.verbose(); 64 bool ok=true;65 64 66 65 SVN* svn=SVN::instance("toy_project"); … … 70 69 } 71 70 72 ok &= test_add(suite);73 ok &= test_blame(suite);74 ok &= test_classic(suite);71 suite.add(test_add(suite)); 72 suite.add(test_blame(suite)); 73 suite.add(test_classic(suite)); 75 74 76 if (verbose) { 77 if (ok) 78 std::cout << "Test is ok.\n"; 79 else 80 std::cout << "Test failed.\n"; 81 } 82 if (ok) 83 return 0; 84 return 1; 75 return suite.exit_status(); 85 76 } 86 77 -
trunk/test/trac_test.cc
r1127 r1162 37 37 { 38 38 using namespace theplu::svndigest; 39 test::Suite suite(argc, argv); 39 40 bool ok=true; 40 41 std::ostream& my_out(std::cout); … … 88 89 ok &= test_no_anchor("r2:3a", my_out); 89 90 90 if (ok) 91 return 0; 92 return -1; 91 suite.add(ok); 92 return suite.exit_status(); 93 93 } 94 94 -
trunk/test/utility_test.cc
r1098 r1162 21 21 */ 22 22 23 #include "../lib/utility.h" 23 #include "Suite.h" 24 25 #include "lib/utility.h" 24 26 25 27 #include <algorithm> … … 33 35 const std::vector<std::string>&); 34 36 35 int main( const int argc,constchar* argv[])37 int main(int argc, char* argv[]) 36 38 { 39 theplu::svndigest::test::Suite suite(argc, argv); 37 40 bool ok=true; 38 41 … … 94 97 ok &= test_regexp(true, "[fa]il?name", "filename", vec); 95 98 96 if (ok) 97 return 0; 98 return 1; 99 suite.add(ok); 100 return suite.exit_status(); 99 101 } 100 102
Note: See TracChangeset
for help on using the changeset viewer.