"Fossies" - the Fresh Open Source Software Archive

Member "xdelta3-3.1.0/testing/test.h" (27 Dec 2015, 1521 Bytes) of package /linux/misc/xdelta3-3.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "test.h": 3.0.11_vs_3.1.0.

    1 // -*- Mode: C++ -*-
    2 
    3 extern "C" {
    4 #include "../xdelta3.h"
    5 #include "../xdelta3-internal.h"
    6 }
    7 
    8 #include <unistd.h>
    9 #include <math.h>
   10 #include <string>
   11 
   12 #define CHECK_EQ(x,y) CHECK_OP(x,y,==)
   13 #define CHECK_NE(x,y) CHECK_OP(x,y,!=)
   14 #define CHECK_LT(x,y) CHECK_OP(x,y,<)
   15 #define CHECK_GT(x,y) CHECK_OP(x,y,>)
   16 #define CHECK_LE(x,y) CHECK_OP(x,y,<=)
   17 #define CHECK_GE(x,y) CHECK_OP(x,y,>=)
   18 
   19 #define CHECK_OP(x,y,OP) \
   20   do { \
   21     __typeof__(x) _x(x); \
   22     __typeof__(x) _y(y); \
   23     if (!(_x OP _y)) { \
   24       cerr << __FILE__ << ":" << __LINE__ << " Check failed: " << #x " " #OP " " #y << endl; \
   25       cerr << __FILE__ << ":" << __LINE__ << " {0} " << _x << endl; \
   26       cerr << __FILE__ << ":" << __LINE__ << " {1} " << _y << endl; \
   27     abort(); \
   28     } } while (false)
   29 #undef CHECK
   30 #define CHECK(x) \
   31   do {if (!(x)) {                      \
   32   cerr << __FILE__ << ":" << __LINE__ << " Check failed: " << #x << endl; \
   33   abort(); \
   34     } } while (false)
   35 
   36 #define DCHECK(x)
   37 
   38 using std::string;
   39 
   40 #include <vector>
   41 using std::vector;
   42 
   43 inline string CommandToString(const vector<const char*> &v) {
   44   string s(v[0]);
   45   for (size_t i = 1; i < v.size() && v[i] != NULL; i++) {
   46     s.append(" ");
   47     s.append(v[i]);
   48   }
   49   return s;
   50 }
   51 
   52 #include <iostream>
   53 using std::cerr;
   54 using std::endl;
   55 using std::ostream;
   56 
   57 #include <map> 
   58 using std::map;
   59 using std::pair;
   60 
   61 #include <list>
   62 using std::list;
   63 
   64 template <typename T, typename U>
   65 pair<T, U> make_pair(const T& t, const U& u) {
   66   return pair<T, U>(t, u);
   67 }
   68 
   69 using std::min;
   70 using std::max;