summaryrefslogtreecommitdiff
path: root/tests/basic-types/gassert.c-expected
blob: f73315a56b63e6bc474058eb553d998aa8361ecc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/* basic_types_gassert.c generated by valac, the Vala compiler
 * generated from basic_types_gassert.vala, do not modify */

#include <glib.h>
#include <float.h>
#include <math.h>

#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

VALA_EXTERN void test_assert_cmpstr (void);
VALA_EXTERN void test_assert_cmpint (void);
VALA_EXTERN void test_assert_cmpuint (void);
VALA_EXTERN void test_assert_cmphex (void);
VALA_EXTERN void test_assert_cmpfloat (void);
static void _vala_main (void);

void
test_assert_cmpstr (void)
{
	g_assert_cmpstr (NULL, ==, NULL);
	g_assert_cmpstr ("", >, NULL);
	g_assert_cmpstr (NULL, <, "");
	g_assert_cmpstr (NULL, <, "");
	g_assert_cmpstr (NULL, !=, "some non-null, non-empty string");
	g_assert_cmpstr (NULL, <, "some non-null, non-empty string");
	g_assert_cmpstr (NULL, <=, "some non-null, non-empty string");
	g_assert_cmpstr ("some non-null, non-empty string", !=, NULL);
	g_assert_cmpstr ("some non-null, non-empty string", >, NULL);
	g_assert_cmpstr ("some non-null, non-empty string", >=, NULL);
	g_assert_cmpstr ("0", <, "1");
	g_assert_cmpstr ("0", <=, "1");
	g_assert_cmpstr ("1", <=, "1");
	g_assert_cmpstr ("2", ==, "2");
	g_assert_cmpstr ("3", >=, "3");
	g_assert_cmpstr ("4", >=, "3");
	g_assert_cmpstr ("4", >, "3");
	g_assert_cmpstr ("4", !=, "3");
}

void
test_assert_cmpint (void)
{
	g_assert_cmpint (0, <, 1);
	g_assert_cmpint (0, !=, 1);
	g_assert_cmpint (0, <=, 1);
	g_assert_cmpint (1, <=, 1);
	g_assert_cmpint (1, ==, 1);
	g_assert_cmpint (1, >=, 1);
	g_assert_cmpint (2, >=, 1);
	g_assert_cmpint (2, >, 1);
	g_assert_cmpint (-1, >, -2);
	g_assert_cmpint (-1, !=, -2);
	g_assert_cmpint (-1, >=, -2);
	g_assert_cmpint (-2, >=, -2);
	g_assert_cmpint (-2, ==, -2);
	g_assert_cmpint (-2, <=, -2);
	g_assert_cmpint (-3, <=, -2);
	g_assert_cmpint (-3, <, -2);
	g_assert_cmpint (-100, <, 101);
	g_assert_cmpint (-100, !=, 101);
	g_assert_cmpint (-100, <=, 101);
	g_assert_cmpint (-101, <=, 101);
	g_assert_cmpint (101, >=, -101);
	g_assert_cmpint (102, >=, -101);
	g_assert_cmpint (102, >, -101);
}

void
test_assert_cmpuint (void)
{
	g_assert_cmpuint (0U, <, 1U);
	g_assert_cmpuint (0U, !=, 1U);
	g_assert_cmpuint (0U, <=, 1U);
	g_assert_cmpuint (1U, <=, 1U);
	g_assert_cmpuint (1U, ==, 1U);
	g_assert_cmpuint (1U, >=, 1U);
	g_assert_cmpuint (2U, >=, 1U);
	g_assert_cmpuint (2U, >, 1U);
}

void
test_assert_cmphex (void)
{
	g_assert_cmphex ((guint) 0x0, <, (guint) 0x1);
	g_assert_cmphex ((guint) 0x0, !=, (guint) 0x1);
	g_assert_cmphex ((guint) 0x0, <=, (guint) 0x1);
	g_assert_cmphex ((guint) 0x1, <=, (guint) 0x1);
	g_assert_cmphex ((guint) 0x1, ==, (guint) 0x1);
	g_assert_cmphex ((guint) 0x1, >=, (guint) 0x1);
	g_assert_cmphex ((guint) 0x2, >=, (guint) 0x1);
	g_assert_cmphex ((guint) 0x2, >, (guint) 0x1);
}

void
test_assert_cmpfloat (void)
{
	g_assert_cmpfloat ((gdouble) 0.0f, <, (gdouble) 1.0f);
	g_assert_cmpfloat ((gdouble) 0.0f, !=, (gdouble) 1.0f);
	g_assert_cmpfloat ((gdouble) 0.0f, <=, (gdouble) 1.0f);
	g_assert_cmpfloat ((gdouble) 1.0f, <=, (gdouble) 1.0f);
	g_assert_cmpfloat ((gdouble) 1.0f, ==, (gdouble) 1.0f);
	g_assert_cmpfloat ((gdouble) 1.0f, >=, (gdouble) 1.0f);
	g_assert_cmpfloat ((gdouble) 2.0f, >=, (gdouble) 1.0f);
	g_assert_cmpfloat ((gdouble) 2.0f, >, (gdouble) 1.0f);
	g_assert_cmpfloat ((gdouble) (-1.0f), >, (gdouble) (-2.0f));
	g_assert_cmpfloat ((gdouble) (-1.0f), !=, (gdouble) (-2.0f));
	g_assert_cmpfloat ((gdouble) (-1.0f), >=, (gdouble) (-2.0f));
	g_assert_cmpfloat ((gdouble) (-2.0f), >=, (gdouble) (-2.0f));
	g_assert_cmpfloat ((gdouble) (-2.0f), ==, (gdouble) (-2.0f));
	g_assert_cmpfloat ((gdouble) (-2.0f), <=, (gdouble) (-2.0f));
	g_assert_cmpfloat ((gdouble) (-3.0f), <=, (gdouble) (-2.0f));
	g_assert_cmpfloat ((gdouble) (-3.0f), <, (gdouble) (-2.0f));
	g_assert_cmpfloat ((gdouble) (-100.0f), <, (gdouble) 101.0f);
	g_assert_cmpfloat ((gdouble) (-100.0f), !=, (gdouble) 101.0f);
	g_assert_cmpfloat ((gdouble) (-100.0f), <=, (gdouble) 101.0f);
	g_assert_cmpfloat ((gdouble) (-101.0f), <=, (gdouble) 101.0f);
	g_assert_cmpfloat ((gdouble) 101.0f, >=, (gdouble) (-101.0f));
	g_assert_cmpfloat ((gdouble) 102.0f, >=, (gdouble) (-101.0f));
	g_assert_cmpfloat ((gdouble) 102.0f, >, (gdouble) (-101.0f));
}

static void
_vala_main (void)
{
	test_assert_cmpstr ();
	test_assert_cmpint ();
	test_assert_cmpuint ();
	test_assert_cmphex ();
	test_assert_cmpfloat ();
}

int
main (int argc,
      char ** argv)
{
	_vala_main ();
	return 0;
}