forked from simdjson/simdjson
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstaticchecks.cpp
More file actions
29 lines (27 loc) · 876 Bytes
/
staticchecks.cpp
File metadata and controls
29 lines (27 loc) · 876 Bytes
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
#include "simdjson.h"
#include "simdjson.cpp"
bool error_messages_in_correct_order() {
std::cout << "Running " << __func__ << std::endl;
using namespace simdjson;
using namespace simdjson::internal;
using namespace std;
if ((sizeof(error_codes)/sizeof(error_code_info)) != NUM_ERROR_CODES) {
cerr << "error_codes does not have all codes in error_code enum (or too many)" << endl;
return false;
}
for (int i=0; i<NUM_ERROR_CODES; i++) {
if (error_codes[i].code != i) {
cerr << "Error " << int(error_codes[i].code) << " at wrong position (" << i << "): " << error_codes[i].message << endl;
return false;
}
}
return true;
}
int main(void) {
if (error_messages_in_correct_order()) {
std::cout << "All static checks successful." << std::endl;
return 0;
}
std::cerr << "Failed static checks." << std::endl;
return 1;
}