Changeset 907 for library/tests
- Timestamp:
- 04/19/10 12:44:57 (15 years ago)
- Location:
- library/tests
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/CMakeLists.txt
r722 r907 1 1 # Make sure the compiler can find include files from our Bdm library. 2 2 include_directories (${BDM_SOURCE_DIR}/bdm) 3 include_directories ( ./unittest-cpp)3 include_directories (${BDM_SOURCE_DIR}/tests/unittest-cpp) 4 4 5 5 # Make sure the linker can find the Hello library once it is built. 6 6 link_directories (${BDM_BINARY_DIR}/bdm) 7 link_directories ( ./unittest-cpp)7 link_directories (${BDM_BINARY_DIR}/tests/unittest-cpp) 8 8 9 9 SET(testutil_src general_suite.cpp general_suite.h epdf_harness.cpp epdf_harness.h mat_checks.cpp mat_checks.h -
library/tests/testsuite/datasource_test.cpp
r795 r907 8 8 TEST ( EpdfDS_test ) { 9 9 UIFile uif ( "epdfds.cfg" ); 10 11 10 shared_ptr<EpdfDS> ds = UI::build<EpdfDS> ( uif, "ds" ); 12 11 -
library/tests/testsuite/logger_test.cpp
r737 r907 32 32 } 33 33 34 class log_tester : public root 35 { 36 LOG_LEVEL(log_tester,logr,logth,logpol); 37 public: 38 RV th, r; 39 int pol, i; 40 41 log_tester() { 42 th = RV ( "{alog blog }" ); 43 r = RV ( "{r }", "2" ); 44 pol = 11; 45 46 log_level[logr] = true; 47 log_level[logth] = true; 48 log_level[logpol] = true; 49 } 50 51 void log_register( logger &L, const string prefix ) { 52 root::log_register( L, prefix ); 53 L.add_vector( log_level, logr, r, prefix ); 54 L.add_vector( log_level, logth, th, prefix ); 55 L.add_setting( log_level, logpol, prefix ); 56 } 57 58 void log_write() const { 59 root::log_write(); 60 log_level.store( logr, vec_2 ( ( double ) i, ( double ) ( i + 1 ) ) ); 61 log_level.store( logth, vec_2 ( ( double ) ( 100 - i ), ( double ) ( i - 50 ) ) ); 62 log_level.store( logpol, pol ); 63 } 64 65 }; 66 34 67 TEST ( memlog_test ) { 35 RV th = RV ( "{alog blog }" );36 RV r = RV ( "{r }", "2" );37 38 68 string ls ( "memlog_test" ); 39 69 remove_all ( ls.c_str() ); … … 41 71 memlog logger ( 100, ls ); 42 72 43 int pol = 11;44 73 45 int rid = logger.add_vector ( r, "" ); 46 int thid = logger.add_vector ( th, "th" ); 47 int polid = logger.add_setting ( "pols" ); 48 74 log_tester tester; 75 tester.log_register( logger, "memlog" ); 76 49 77 logger.init(); 50 78 51 for ( int i = 0; i < 10; i++ ) { 52 logger.log_vector ( rid, vec_2 ( ( double ) i, ( double ) ( i + 1 ) ) ); 53 logger.log_vector ( thid, vec_2 ( ( double ) ( 100 - i ), ( double ) ( i - 50 ) ) ); 54 UI::save ( pol, logger.log_to_setting ( polid ), "polozka" ); 79 for ( tester.i = 0; tester.i < 10; tester.i++ ) { 80 tester.log_write(); 55 81 logger.step(); 56 82 } … … 63 89 64 90 TEST ( dirfilelog_test ) { 65 RV th = RV ( "{alog blog }" ); 66 RV r = RV ( "{r }", "2" ); 91 67 92 68 93 string ls ( "exp" ); … … 71 96 remove_all ( "dirfilelog_files" ); 72 97 73 dirfilelog L( "dirfilelog_files", 10 );98 dirfilelog logger ( "dirfilelog_files", 10 ); 74 99 75 int rid = L.add_vector ( r, "" );76 int thid = L.add_vector ( th, "th" );100 log_tester tester; 101 tester.log_register( logger, "dirfilelog" ); 77 102 78 L.init();103 logger.init(); 79 104 80 for ( int i = 0; i < 150; i++ ) { 81 L.log_vector ( rid, vec_2 ( ( double ) i, ( double ) ( i + 1 ) ) ); 82 L.log_vector ( thid, vec_2 ( ( double ) ( 100 - i ), ( double ) ( i - 50 ) ) ); 83 L.step(); 105 for ( tester.i = 0; tester.i < 150; tester.i++ ) { 106 tester.log_write(); 107 logger.step(); 84 108 } 85 109 86 L.finalize();110 logger.finalize(); 87 111 88 112 std::string expected ( load_test_file ( "logger_test_dirfile_format.matrix" ) );