13 #include <boost/format.hpp>
14 #include <cppunit/extensions/HelperMacros.h>
15 #include <utl/System.h>
16 #include <tst/Verify.h>
17 #include <tst/Validatrix.h>
18 #include <utl/Trace.h>
19 #include <utl/AugerUnits.h>
21 using namespace tst::Validatrix;
23 using namespace boost;
36 CPPUNIT_TEST(TestBuiltin);
37 CPPUNIT_TEST(TestBuiltinFail);
38 CPPUNIT_TEST(TestTraceD);
39 CPPUNIT_TEST(TestVectorUnsignedShort);
40 CPPUNIT_TEST(TestVectorUnsignedShortFail);
41 CPPUNIT_TEST(TestZeroLengthVector);
43 CPPUNIT_TEST_SUITE_END();
45 template<
int n,
class FStream>
50 for (
int i = 0; i < n; ++i) {
51 fFilename[i] = (format(
"%1%%2%.trx") % prefix % i).str();
52 fStream[i].open(fFilename[i].c_str());
53 CPPUNIT_ASSERT(fStream[i].is_open());
60 FStream&
Get() {
return fStream[i]; }
66 string command =
"rm";
67 for (
int i = 0; i < n; ++i)
68 command.append(
string(
" ") + fFilename[i]);
76 for (
int i = 0; i < n; ++i)
77 if (fStream[i].is_open())
96 const string prefix =
"foo_1_";
113 CPPUNIT_ASSERT(test);
123 const string prefix =
"foo_2_";
145 CPPUNIT_ASSERT(!test);
155 const string prefix =
"foo_3_";
159 const int size = 768;
162 for (
int i = 0; i < size; ++i)
163 trace[i] = 3.14*(i+1);
172 for (
int i = 0; i < size; ++i)
180 for (
int i = 0; i < size; ++i)
191 CPPUNIT_ASSERT(test);
201 const string prefix =
"foo_4_";
205 vector<unsigned short> vec(100, 13
U);
206 for (
int i = 50; i < 60; ++i)
207 vec[i] = (
unsigned short)(i);
216 CPPUNIT_ASSERT(test);
226 const string prefix =
"foo_5_";
230 vector<unsigned short> vec1(100, 13
U);
231 for (
int i = 50; i < 60; ++i)
232 vec1[i] = (
unsigned short)(i);
233 vector<unsigned short> vec2 = vec1;
243 CPPUNIT_ASSERT(!test);
253 const string prefix =
"foo_6_";
266 CPPUNIT_ASSERT(test);
277 ofstream f1(
"f1.trx");
281 ifstream f1(
"f1.trx");
282 ifstream f2(
"f2.trx");
283 const bool test =
Compare(f1, f2);
284 CPPUNIT_ASSERT(!test);
void TestZeroLengthVector()
std::string BeCloseRel(const T &value, const double tolerance=kDefaultTolerance)
void System(const char *const command, const bool throwOnError, const bool notify)
void TestVectorUnsignedShortFail()
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
std::string BeCloseAbs(const T &value, const double tolerance=kDefaultTolerance)
bool Compare(const string &oldFilename, const string &newFilename, const bool failOnFirst)
constexpr double nanosecond
std::string BeLabel(const string &tag)
void Expected()
Print `Expected' for expected failures.
Base class for inconsistency/illogicality exceptions.
Streams(const string &prefix)
std::string BeEqual(const T &value)
void TestVectorUnsignedShort()