Git init
[pkgs/e/elektra.git] / src / bindings / cpp / tests / tests.h
1 /**Some common functions in use for testing framework*/
2
3 /***************************************************************************
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the BSD License (revised).                      *
7  *                                                                         *
8  ***************************************************************************/
9
10 #include <kdb>
11
12 #include <exception>
13 #include <iostream>
14 #include <string>
15 #include <cstring>
16
17 using namespace std;
18 using namespace kdb;
19
20 extern int nbError;
21 extern int nbTest;
22
23 #define warn_if_fail(x,y) {nbTest++; if (!(x)) { printf("%s:%d: warn in %s: %s\n", __FILE__, __LINE__, __FUNCTION__, y); }}
24 #define succeed_if(x,y) nbTest++; if (!(x)) { nbError++; printf("%s:%d: error in %s: %s\n", __FILE__, __LINE__, __FUNCTION__, y);}
25 #define exit_if_fail(x,y) nbTest++; if (!(x)) { printf("%s:%d: fatal in %s: %s\n", __FILE__, __LINE__, __FUNCTION__, y); exit(1); }
26