versadac  1
versadac - Scalable Recorder Firmware
validyMacros.h
1 #ifndef JSON_TESTSUITE_JSON_VALIDATOR_RESOURCES_VALIDITY_MACROS_H
2 #define JSON_TESTSUITE_JSON_VALIDATOR_RESOURCES_VALIDITY_MACROS_H
3 
4 #include "../../../../JSONOptions.h"
5 
6 #ifdef JSON_VALIDATE
7 
8  #define assertValid(x, method, nextchar)\
9  {\
10  json_string temp(JSON_TEXT(x));\
11  const json_char * ptr = temp.c_str();\
12  assertTrue(JSONValidator::method(ptr) && ((*ptr)==JSON_TEXT(nextchar)));\
13  }
14 
15  #define assertNotValid(x, method, nextchar)\
16  {\
17  json_string temp(JSON_TEXT(x));\
18  const json_char * ptr = temp.c_str();\
19  assertTrue(!JSONValidator::method(ptr) || ((*ptr)!=JSON_TEXT(nextchar)));\
20  }
21 
22  #ifdef JSON_SECURITY_MAX_NEST_LEVEL
23  #define assertValid_Depth(x, method, nextchar)\
24  {\
25  json_string temp(JSON_TEXT(x));\
26  const json_char * ptr = temp.c_str();\
27  assertTrue(JSONValidator::method(ptr, 1) && ((*ptr)==JSON_TEXT(nextchar)));\
28  }
29 
30  #define assertNotValid_Depth(x, method, nextchar)\
31  {\
32  json_string temp(JSON_TEXT(x));\
33  const json_char * ptr = temp.c_str();\
34  assertTrue(!JSONValidator::method(ptr, 1) || ((*ptr)!=JSON_TEXT(nextchar)));\
35  }
36  #else
37  #define assertValid_Depth(x, method, nextchar) assertValid(x, method, nextchar)
38  #define assertNotValid_Depth(x, method, nextchar) assertNotValid(x, method, nextchar)
39  #endif
40 
41 #else
42  #define assertValid(x, method, nextchar)
43  #define assertNotValid(x, method, nextchar)
44  #define assertValid_Depth(x, method, nextchar)
45  #define assertNotValid_Depth(x, method, nextchar)
46 #endif
47 
48 #endif