Changeset 1119
- Timestamp:
- Feb 21, 2008, 11:27:48 PM (16 years ago)
- Location:
- trunk/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Makefile.am
r1117 r1119 40 40 statistics_test subset_generator_test svd_test svm_test target_test \ 41 41 ttest_test \ 42 utility_test vector_test 42 utility_test vector_test view_test 43 43 44 44 check_PROGRAMS = $(TESTS) 45 45 46 46 # tests that fail are only built not included in check 47 check_PROGRAMS += view_test47 #check_PROGRAMS += 48 48 49 49 LDADD = @top_builddir@/$(YAT_LIB_LOCATION)/$(YAT_LIB) -
trunk/test/view_test.cc
r1114 r1119 28 28 #include "yat/utility/VectorConstView.h" 29 29 30 #include <fstream> 30 31 #include <iostream> 31 32 #include <string> 32 33 33 using namespace theplu::yat::utility;34 35 36 void f(const VectorBase& aa, VectorMutable& bb) {37 std::cout << "f aa: " << aa << std::endl;38 std::cout << "f bb: " << bb << std::endl;39 }40 41 34 int main(const int argc,const char* argv[]) 42 35 { 36 using namespace theplu::yat::utility; 37 std::ostream* message; 38 if (argc>1 && argv[1]==std::string("-v")) 39 message = &std::cerr; 40 else { 41 message = new std::ofstream("/dev/null"); 42 if (argc>1) 43 std::cout << "vector_test -v : for printing extra " << "information\n"; 44 } 45 *message << "testing vector" << std::endl; 46 bool ok = true; 43 47 44 48 matrix data1; … … 53 57 VectorView b=data2.column_view(0); 54 58 55 std::cout << "First\n"; 56 f(a,b); 59 data1.column_const_view(0); 60 if (b.size()!=3){ 61 ok =false; 62 *message << "ERROR: expected size to be 3 - found " << b.size() << std::endl; 63 } 64 if ( !(b(0)==1 && b(1)==(1) && b(2)==1) ) 65 ok = false; 66 57 67 58 std::cout << "Second\n"; 59 f(a,b); 68 if (ok) 69 *message << "test is ok" << std::endl; 70 else 71 *message << "view test failed" << std::endl; 60 72 61 std::cout << "Third\n";62 f(data1.column_const_view(0),b);73 if (message!=&std::cerr) 74 delete message; 63 75 64 std::cout << "Fourth\n"; 65 f(a,b); 66 67 std::cout << "data 2:\n" << data2 << std::endl; 76 return (ok ? 0 : -1); 68 77 } 69 78
Note: See TracChangeset
for help on using the changeset viewer.