-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cpp
130 lines (86 loc) · 1.44 KB
/
test.cpp
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
#include <cctype>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/time.h>
#include <map>
#include <mutex>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <Semver.hpp>
/**
* Equal
*
*/
void test_equal() {
printf("is equal:\t ");
Semver a("0.0.1");
Semver b("0.0.1");
assert(a == b);
printf("PASSED\n");
}
/**
* Not equal
*
*/
void test_not_equal() {
printf("not equal:\t ");
Semver a("0.0.1");
Semver b("0.0.2");
assert(a != b);
assert(b != a);
printf("PASSED\n");
}
/**
* Greater than
*
*/
void test_gt() {
printf("greater than:\t ");
Semver a("0.0.1");
Semver b("0.0.2");
assert(b > a);
Semver c("0.0.1");
Semver d("0.1.2");
assert(d > c);
Semver e("0.1.1");
Semver f("1.0.0");
assert(f > e);
printf("PASSED\n");
}
/**
* Less than
*
*/
void test_lt() {
printf("less than:\t ");
Semver a("0.0.1");
Semver b("0.0.2");
assert(a < b);
Semver c("0.0.1");
Semver d("0.1.2");
assert(c < d);
Semver e("0.1.1");
Semver f("1.0.0");
assert(e < f);
printf("PASSED\n");
}
/**
* Entry point
*
*/
extern "C" {
int main();
}
int main() {
printf("\n********\nsemver_espidf tests\n\n********\n\n");
test_equal();
test_not_equal();
test_gt();
test_lt();
return 0;
}