Changeset 1360
- Timestamp:
- Jun 26, 2008, 3:17:58 AM (14 years ago)
- Location:
- trunk/test
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Suite.h
r1304 r1360 26 26 27 27 #include <fstream> 28 #include <sstream> 28 29 29 30 namespace theplu { … … 91 92 int return_value(void) const; 92 93 94 /** 95 Function writes to a stream using operator<<, creates a new 96 object using stream constructor, and the new object is written 97 to another stream, and function check if the two outputs are 98 equal. 99 */ 100 template<class T> 101 bool test_stream(const T&) const; 102 93 103 private: 94 104 bool verbose_; … … 118 128 } 119 129 130 131 template<class T> 132 bool Suite::test_stream(const T& t) const 133 { 134 this->err() << "Checking that output stream is valid as an input stream\n"; 135 std::stringstream ss; 136 this->err() << "writing to output\n"; 137 ss << t; 138 this->err() << "creating a new object from output\n"; 139 T t2(ss); 140 std::stringstream ss2; 141 this->err() << "writing to output\n"; 142 ss2 << t2; 143 bool ok = ss2.str()==ss.str(); 144 if (!ok) { 145 this->err() << "ERROR: first object gave following output:\n" 146 << ss.str() << "\n" 147 << "ERROR: and second object gave following output:\n" 148 << ss2.str() << "\n"; 149 } 150 return ok; 151 } 152 120 153 }}} 121 154 -
trunk/test/matrix_lookup_test.cc
r1275 r1360 54 54 else 55 55 suite.err() << "Ok" << std::endl; 56 57 // FIXME - see ticket:389 58 //suite.add(suite.test_stream(m1)); 56 59 57 60 -
trunk/test/matrix_test.cc
r1275 r1360 57 57 for (size_t i=0; i<unit3x3.rows(); ++i) 58 58 unit3x3(i,i)=1; 59 60 suite.add(suite.test_stream(unit3x3)); 59 61 60 62 suite.err() << "\tcopy constructor and operator!=" << std::endl; -
trunk/test/vector_test.cc
r1275 r1360 58 58 for (size_t i=0; i<vec.size(); i++) 59 59 vec(i)=i; 60 61 suite.add(suite.test_stream(vec)); 60 62 61 63 // checking that shuffle works
Note: See TracChangeset
for help on using the changeset viewer.