File: staticchecks.cpp

package info (click to toggle)
simdjson 4.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,936 kB
  • sloc: cpp: 171,612; ansic: 19,122; sh: 1,126; python: 842; makefile: 47; ruby: 25; javascript: 13
file content (29 lines) | stat: -rw-r--r-- 876 bytes parent folder | download | duplicates (4)
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;
}