summaryrefslogtreecommitdiff
path: root/xdelta3/testing/test.h
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2008-06-30 05:15:05 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2008-06-30 05:15:05 +0000
commit9e896b470f5a4550a7fbbdc515db08b0249f5950 (patch)
tree8f2ea4d701f554a578a7d7e441f98e1f77425e9a /xdelta3/testing/test.h
parente127914b71638072798f7c02e93caf9377ba7385 (diff)
A test is taking shape...
Diffstat (limited to 'xdelta3/testing/test.h')
-rw-r--r--xdelta3/testing/test.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/xdelta3/testing/test.h b/xdelta3/testing/test.h
new file mode 100644
index 0000000..dcec6d9
--- /dev/null
+++ b/xdelta3/testing/test.h
@@ -0,0 +1,59 @@
1/* -*- Mode: C++ -*- */
2
3extern "C" {
4#define NOT_MAIN 1
5#define REGRESSION_TEST 0
6#include "../xdelta3.c"
7}
8
9#define CHECK_EQ(x,y) CHECK_OP(x,y,==)
10#define CHECK_LT(x,y) CHECK_OP(x,y,<)
11#define CHECK_GT(x,y) CHECK_OP(x,y,>)
12#define CHECK_LE(x,y) CHECK_OP(x,y,<=)
13#define CHECK_GE(x,y) CHECK_OP(x,y,>=)
14
15#define CHECK_OP(x,y,OP) \
16do {if (!((x) OP (y))) { \
17 cerr << "Check failed: " << #x " " #OP " " #y << endl; \
18 cerr << "Expected: " << x << endl; \
19 cerr << "Actual: " << y << endl; \
20 abort(); \
21 } } while (false)
22
23#define CHECK(x) \
24 do {if (!(x)) { \
25 cerr << "Check failed: " << #x << endl; \
26 abort(); \
27 } } while (false)
28
29#include <iostream>
30using std::cerr;
31using std::endl;
32
33#include <map>
34using std::map;
35using std::pair;
36
37template <typename T, typename U>
38pair<T, U> make_pair(const T& t, const U& u) {
39 return pair<T, U>(t, u);
40}
41
42class Constants {
43public:
44 static const xoff_t BLOCK_SIZE = 1 << 14;
45};
46
47using std::min;
48
49#include "random.h"
50using regtest::MTRandom;
51
52#include "file.h"
53using regtest::FileSpec;
54
55#include "modify.h"
56using regtest::Modify1stByte;
57
58#include "cmp.h"
59using regtest::CmpDifferentBytes;