Apply pre-commit fixes
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
This commit is contained in:
parent
143b0f6696
commit
fe780a7fa3
@ -1,6 +1,4 @@
|
||||
---
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
#AlignConsecutiveAssignments: true
|
||||
#AlignConsecutiveDeclarations: true
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
@ -14,4 +12,3 @@ SpaceAfterCStyleCast: true
|
||||
TabWidth: 4
|
||||
AccessModifierOffset: -4
|
||||
UseTab: ForIndentation
|
||||
...
|
||||
|
||||
@ -60,8 +60,7 @@ static const short _address_key_offsets[] = {
|
||||
1177, 1185, 1194, 1203, 1212, 1224, 1235, 1244,
|
||||
1253, 1261, 1270, 1279, 1288, 1300, 1311, 1320,
|
||||
1329, 1337, 1339, 1353, 1355, 1357, 1359, 1361,
|
||||
1363, 1365, 1367, 1368, 1370, 1388, 0
|
||||
};
|
||||
1363, 1365, 1367, 1368, 1370, 1388, 0};
|
||||
|
||||
static const signed char _address_trans_keys[] = {
|
||||
-32, -19, -16, -12, 34, 45, 61, 63,
|
||||
@ -237,8 +236,7 @@ static const signed char _address_trans_keys[] = {
|
||||
-97, -112, -65, -128, -65, -128, -113, 64,
|
||||
32, 126, -32, -19, -16, -12, 45, 46,
|
||||
-62, -33, -31, -17, -15, -13, 48, 57,
|
||||
65, 90, 97, 122, 0
|
||||
};
|
||||
65, 90, 97, 122, 0};
|
||||
|
||||
static const signed char _address_single_lengths[] = {
|
||||
0, 8, 0, 8, 0, 0, 0, 0,
|
||||
@ -265,8 +263,7 @@ static const signed char _address_single_lengths[] = {
|
||||
2, 3, 3, 3, 4, 3, 3, 3,
|
||||
2, 3, 3, 3, 4, 3, 3, 3,
|
||||
2, 2, 6, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 6, 0, 0
|
||||
};
|
||||
0, 0, 1, 0, 6, 0, 0};
|
||||
|
||||
static const signed char _address_range_lengths[] = {
|
||||
0, 8, 1, 8, 1, 1, 1, 1,
|
||||
@ -293,8 +290,7 @@ static const signed char _address_range_lengths[] = {
|
||||
3, 3, 3, 3, 4, 4, 3, 3,
|
||||
3, 3, 3, 3, 4, 4, 3, 3,
|
||||
3, 0, 4, 1, 1, 1, 1, 1,
|
||||
1, 1, 0, 1, 6, 0, 0
|
||||
};
|
||||
1, 1, 0, 1, 6, 0, 0};
|
||||
|
||||
static const short _address_index_offsets[] = {
|
||||
0, 0, 17, 19, 36, 38, 40, 42,
|
||||
@ -321,8 +317,7 @@ static const short _address_index_offsets[] = {
|
||||
917, 923, 930, 937, 944, 953, 961, 968,
|
||||
975, 981, 988, 995, 1002, 1011, 1019, 1026,
|
||||
1033, 1039, 1042, 1053, 1055, 1057, 1059, 1061,
|
||||
1063, 1065, 1067, 1069, 1071, 1084, 0
|
||||
};
|
||||
1063, 1065, 1067, 1069, 1071, 1084, 0};
|
||||
|
||||
static const short _address_cond_targs[] = {
|
||||
4, 6, 7, 9, 186, 3, 3, 3,
|
||||
@ -485,8 +480,7 @@ static const short _address_cond_targs[] = {
|
||||
171, 172, 173, 174, 175, 176, 177, 178,
|
||||
179, 180, 181, 182, 183, 184, 185, 186,
|
||||
187, 188, 189, 190, 191, 192, 193, 194,
|
||||
195, 196, 197, 0
|
||||
};
|
||||
195, 196, 197, 0};
|
||||
|
||||
static const signed char _address_cond_actions[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@ -649,8 +643,7 @@ static const signed char _address_cond_actions[] = {
|
||||
3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 0, 0, 0
|
||||
};
|
||||
3, 0, 0, 0};
|
||||
|
||||
static const short _address_eof_trans[] = {
|
||||
1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093,
|
||||
@ -677,8 +670,7 @@ static const short _address_eof_trans[] = {
|
||||
1254, 1255, 1256, 1257, 1258, 1259, 1260, 1261,
|
||||
1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269,
|
||||
1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277,
|
||||
1278, 1279, 1280, 1281, 1282, 1283, 0
|
||||
};
|
||||
1278, 1279, 1280, 1281, 1282, 1283, 0};
|
||||
|
||||
static const int address_start = 1;
|
||||
static const int address_first_final = 196;
|
||||
@ -686,109 +678,106 @@ static const int address_error = 0;
|
||||
|
||||
static const int address_en_main = 1;
|
||||
|
||||
|
||||
#line 112 "smtp-address-validator.rl"
|
||||
|
||||
|
||||
bool is_address(const char* p, const char* pe)
|
||||
bool is_address(const char *p, const char *pe)
|
||||
{
|
||||
int cs = 0;
|
||||
|
||||
const char* eof = pe;
|
||||
const char *eof = pe;
|
||||
|
||||
bool result = false;
|
||||
|
||||
|
||||
#line 675 "smtp-address-validator.cpp"
|
||||
{
|
||||
cs = (int)address_start;
|
||||
cs = (int) address_start;
|
||||
}
|
||||
|
||||
#line 124 "smtp-address-validator.rl"
|
||||
|
||||
|
||||
#line 680 "smtp-address-validator.cpp"
|
||||
{
|
||||
int _klen;
|
||||
unsigned int _trans = 0;
|
||||
const signed char * _keys;
|
||||
const signed char * _acts;
|
||||
const signed char *_keys;
|
||||
const signed char *_acts;
|
||||
unsigned int _nacts;
|
||||
_resume: {}
|
||||
if ( p == pe && p != eof )
|
||||
_resume : {
|
||||
}
|
||||
if (p == pe && p != eof)
|
||||
goto _out;
|
||||
if ( p == eof ) {
|
||||
if ( _address_eof_trans[cs] > 0 ) {
|
||||
_trans = (unsigned int)_address_eof_trans[cs] - 1;
|
||||
if (p == eof) {
|
||||
if (_address_eof_trans[cs] > 0) {
|
||||
_trans = (unsigned int) _address_eof_trans[cs] - 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_keys = ( _address_trans_keys + (_address_key_offsets[cs]));
|
||||
_trans = (unsigned int)_address_index_offsets[cs];
|
||||
} else {
|
||||
_keys = (_address_trans_keys + (_address_key_offsets[cs]));
|
||||
_trans = (unsigned int) _address_index_offsets[cs];
|
||||
|
||||
_klen = (int)_address_single_lengths[cs];
|
||||
if ( _klen > 0 ) {
|
||||
_klen = (int) _address_single_lengths[cs];
|
||||
if (_klen > 0) {
|
||||
const signed char *_lower = _keys;
|
||||
const signed char *_upper = _keys + _klen - 1;
|
||||
const signed char *_mid;
|
||||
while ( 1 ) {
|
||||
if ( _upper < _lower ) {
|
||||
while (1) {
|
||||
if (_upper < _lower) {
|
||||
_keys += _klen;
|
||||
_trans += (unsigned int)_klen;
|
||||
_trans += (unsigned int) _klen;
|
||||
break;
|
||||
}
|
||||
|
||||
_mid = _lower + ((_upper-_lower) >> 1);
|
||||
if ( ( (*( p))) < (*( _mid)) )
|
||||
_mid = _lower + ((_upper - _lower) >> 1);
|
||||
if (((*(p))) < (*(_mid)))
|
||||
_upper = _mid - 1;
|
||||
else if ( ( (*( p))) > (*( _mid)) )
|
||||
else if (((*(p))) > (*(_mid)))
|
||||
_lower = _mid + 1;
|
||||
else {
|
||||
_trans += (unsigned int)(_mid - _keys);
|
||||
_trans += (unsigned int) (_mid - _keys);
|
||||
goto _match;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_klen = (int)_address_range_lengths[cs];
|
||||
if ( _klen > 0 ) {
|
||||
_klen = (int) _address_range_lengths[cs];
|
||||
if (_klen > 0) {
|
||||
const signed char *_lower = _keys;
|
||||
const signed char *_upper = _keys + (_klen<<1) - 2;
|
||||
const signed char *_upper = _keys + (_klen << 1) - 2;
|
||||
const signed char *_mid;
|
||||
while ( 1 ) {
|
||||
if ( _upper < _lower ) {
|
||||
_trans += (unsigned int)_klen;
|
||||
while (1) {
|
||||
if (_upper < _lower) {
|
||||
_trans += (unsigned int) _klen;
|
||||
break;
|
||||
}
|
||||
|
||||
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
|
||||
if ( ( (*( p))) < (*( _mid)) )
|
||||
_mid = _lower + (((_upper - _lower) >> 1) & ~1);
|
||||
if (((*(p))) < (*(_mid)))
|
||||
_upper = _mid - 2;
|
||||
else if ( ( (*( p))) > (*( _mid + 1)) )
|
||||
else if (((*(p))) > (*(_mid + 1)))
|
||||
_lower = _mid + 2;
|
||||
else {
|
||||
_trans += (unsigned int)((_mid - _keys)>>1);
|
||||
_trans += (unsigned int) ((_mid - _keys) >> 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_match: {}
|
||||
_match : {
|
||||
}
|
||||
cs = (int)_address_cond_targs[_trans];
|
||||
}
|
||||
cs = (int) _address_cond_targs[_trans];
|
||||
|
||||
if ( _address_cond_actions[_trans] != 0 ) {
|
||||
if (_address_cond_actions[_trans] != 0) {
|
||||
|
||||
_acts = ( _address_actions + (_address_cond_actions[_trans]));
|
||||
_nacts = (unsigned int)(*( _acts));
|
||||
_acts = (_address_actions + (_address_cond_actions[_trans]));
|
||||
_nacts = (unsigned int) (*(_acts));
|
||||
_acts += 1;
|
||||
while ( _nacts > 0 ) {
|
||||
switch ( (*( _acts)) )
|
||||
{
|
||||
while (_nacts > 0) {
|
||||
switch ((*(_acts))) {
|
||||
case 0: {
|
||||
{
|
||||
#line 108 "smtp-address-validator.rl"
|
||||
result = true; }
|
||||
result = true;
|
||||
}
|
||||
|
||||
#line 762 "smtp-address-validator.cpp"
|
||||
|
||||
@ -797,7 +786,8 @@ bool is_address(const char* p, const char* pe)
|
||||
case 1: {
|
||||
{
|
||||
#line 108 "smtp-address-validator.rl"
|
||||
result = false; }
|
||||
result = false;
|
||||
}
|
||||
|
||||
#line 770 "smtp-address-validator.cpp"
|
||||
|
||||
@ -807,24 +797,22 @@ bool is_address(const char* p, const char* pe)
|
||||
_nacts -= 1;
|
||||
_acts += 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( p == eof ) {
|
||||
if ( cs >= 196 )
|
||||
if (p == eof) {
|
||||
if (cs >= 196)
|
||||
goto _out;
|
||||
}
|
||||
else {
|
||||
if ( cs != 0 ) {
|
||||
} else {
|
||||
if (cs != 0) {
|
||||
p += 1;
|
||||
goto _resume;
|
||||
}
|
||||
}
|
||||
_out: {}
|
||||
_out : {
|
||||
}
|
||||
}
|
||||
|
||||
#line 125 "smtp-address-validator.rl"
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -29,6 +29,6 @@ SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
bool is_address(const char* p, const char* pe);
|
||||
bool is_address(const char *p, const char *pe);
|
||||
|
||||
#endif // SMTP_ADDRESS_PARSER_HPP_INCLUDED
|
||||
|
||||
@ -182,7 +182,7 @@ const std::string uuid{R"([0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-
|
||||
// from http://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
|
||||
const std::string hostname{R"(^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$)"};
|
||||
|
||||
bool is_ascii(std::string const& value)
|
||||
bool is_ascii(std::string const &value)
|
||||
{
|
||||
for (auto ch : value) {
|
||||
if (ch & 0x80) {
|
||||
|
||||
@ -149,7 +149,7 @@ int main()
|
||||
// TODO when we set `string` in array and set `contentEncoding` = "binary" - what it means? We expected string or binary?
|
||||
// Or we expect only binary? Now if you set `contentEncoding` = "binary", then it means that you expect only binary data,
|
||||
// not string
|
||||
//val.validate({{"something", "string"}}, err); -> produce error about type
|
||||
// val.validate({{"something", "string"}}, err); -> produce error about type
|
||||
EXPECT_EQ(err.failed_pointers.size(), 0);
|
||||
err.reset();
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ int main(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( !single_op["value"].is_object() || !single_op["value"].empty()) {
|
||||
if (!single_op["value"].is_object() || !single_op["value"].empty()) {
|
||||
std::cerr << "Patch with defaults contains wrong value" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -4,5 +4,3 @@ add_test_simple_schema(Issue::27
|
||||
set_tests_properties(Issue::27
|
||||
PROPERTIES
|
||||
WILL_FAIL 1)
|
||||
|
||||
|
||||
|
||||
@ -27,22 +27,22 @@ using nlohmann::json_patch;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
OK( json_patch p1( R"([{"op":"add","path":"/0/renderable/bg","value":"Black"}])"_json));
|
||||
OK( json_patch p1( R"([{"op":"replace","path":"/0/renderable/bg","value":"Black"}])"_json));
|
||||
OK( json_patch p1( R"([{"op":"remove","path":"/0/renderable/bg"}])"_json));
|
||||
OK(json_patch p1(R"([{"op":"add","path":"/0/renderable/bg","value":"Black"}])"_json));
|
||||
OK(json_patch p1(R"([{"op":"replace","path":"/0/renderable/bg","value":"Black"}])"_json));
|
||||
OK(json_patch p1(R"([{"op":"remove","path":"/0/renderable/bg"}])"_json));
|
||||
|
||||
// value not needed
|
||||
KO( json_patch p1( R"([{"op":"remove","path":"/0/renderable/bg", "value":"Black"}])"_json));
|
||||
KO(json_patch p1(R"([{"op":"remove","path":"/0/renderable/bg", "value":"Black"}])"_json));
|
||||
// value missing
|
||||
KO( json_patch p1( R"([{"op":"add","path":"/0/renderable/bg"}])"_json));
|
||||
KO(json_patch p1(R"([{"op":"add","path":"/0/renderable/bg"}])"_json));
|
||||
// value missing
|
||||
KO( json_patch p1( R"([{"op":"replace","path":"/0/renderable/bg"}])"_json));
|
||||
KO(json_patch p1(R"([{"op":"replace","path":"/0/renderable/bg"}])"_json));
|
||||
|
||||
// wrong op
|
||||
KO( json_patch p1( R"([{"op":"ad","path":"/0/renderable/bg","value":"Black"}])"_json));
|
||||
KO(json_patch p1(R"([{"op":"ad","path":"/0/renderable/bg","value":"Black"}])"_json));
|
||||
|
||||
// invalid json-pointer
|
||||
KO( json_patch p1( R"([{"op":"add","path":"0/renderable/bg","value":"Black"}])"_json));
|
||||
KO(json_patch p1(R"([{"op":"add","path":"0/renderable/bg","value":"Black"}])"_json));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user