Allow moving fullscreen windows between monitors
[openbox.git] / obt / unittest_base.h
blob85106bb320c5b2b177770102813dbc5623652b14
1 #ifndef __obt_unittest_base_h
2 #define __obt_unittest_base_h
4 #include <glib.h>
5 #include <stdio.h>
7 G_BEGIN_DECLS
9 extern guint g_test_failures;
10 extern guint g_test_failures_at_test_start;
11 extern const gchar* g_active_test_suite;
12 extern const gchar* g_active_test_name;
14 #define ADD_FAILURE() { ++g_test_failures; }
16 #define FAILURE_AT() \
17 fprintf(stderr, "Failure at %s:%u\n", __FILE__, __LINE__); \
18 ADD_FAILURE();
20 #define EXPECT_BOOL_EQ(expected, actual) \
21 if ((expected) != (actual)) { \
22 FAILURE_AT(); \
23 fprintf(stderr, "Expected: %s\nActual: %s\n", \
24 ((expected) ? "true" : "false"), \
25 ((actual) ? "true" : "false")); \
28 #define EXPECT_CHAR_EQ(expected, actual) \
29 if ((expected) != (actual)) { \
30 FAILURE_AT(); \
31 fprintf(stderr, "Expected: %c\nActual: %c\n", (expected), (actual)); \
34 #define EXPECT_INT_EQ(expected, actual) \
35 if ((expected) != (actual)) { \
36 FAILURE_AT(); \
37 fprintf(stderr, "Expected: %d\nActual: %d\n", (expected), (actual)); \
40 #define EXPECT_UINT_EQ(expected, actual) \
41 if ((expected) != (actual)) { \
42 FAILURE_AT(); \
43 fprintf(stderr, "Expected: %u\nActual: %u\n", (expected), (actual)); \
46 #define EXPECT_STRING_EQ(expected, actual) \
47 if ((expected) != (actual)) { \
48 FAILURE_AT(); \
49 fprintf(stderr, "Expected: %s\nActual: %s\n", \
50 ((expected) ? (expected) : "NULL"), \
51 ((actual) ? (actual) : NULL)); \
54 void unittest_start_suite(const char* suite_name);
55 void unittest_end_suite();
57 void unittest_start(const char* test_name);
58 void unittest_end();
60 #define TEST_START() unittest_start(__func__);
61 #define TEST_END() unittest_end();
63 G_END_DECLS
65 #endif