#include "../src/json-patch.hpp"
#include <iostream>
Go to the source code of this file.
|
| #define | OK(code) |
| #define | KO(code) |
◆ KO
Value: do { \
try { \
code; \
std::cerr << "UNEXPECTED SUCCESS.\n"; \
return 1; \
} catch (const std::exception &e) { \
std::cerr << "EXPECTED FAIL: " << e.what() << "\n"; \
} \
} while (0)
Definition at line 17 of file json-patch.cpp.
17#define KO(code) \
18 do { \
19 try { \
20 code; \
21 std::cerr << "UNEXPECTED SUCCESS.\n"; \
22 return 1; \
23 } catch (const std::exception &e) { \
24 std::cerr << "EXPECTED FAIL: " << e.what() << "\n"; \
25 } \
26 } while (0)
◆ OK
Value: do { \
try { \
code; \
} catch (const std::exception &e) { \
std::cerr << "UNEXPECTED FAILED: " << e.what() << "\n"; \
return 1; \
} \
} while (0)
Definition at line 7 of file json-patch.cpp.
7#define OK(code) \
8 do { \
9 try { \
10 code; \
11 } catch (const std::exception &e) { \
12 std::cerr << "UNEXPECTED FAILED: " << e.what() << "\n"; \
13 return 1; \
14 } \
15 } while (0)
◆ main()
Definition at line 28 of file json-patch.cpp.
29{
30 OK(
json_patch p1(R
"([{"op":"add","path":"/0/renderable/bg","value":"Black"}])"_json));
31 OK(json_patch p1(R"([{"op":"replace","path":"/0/renderable/bg","value":"Black"}])"_json));
32 OK(json_patch p1(R"([{"op":"remove","path":"/0/renderable/bg"}])"_json));
33
34
35 KO(
json_patch p1(R
"([{"op":"remove","path":"/0/renderable/bg", "value":"Black"}])"_json));
36
37 KO(
json_patch p1(R
"([{"op":"add","path":"/0/renderable/bg"}])"_json));
38
39 KO(
json_patch p1(R
"([{"op":"replace","path":"/0/renderable/bg"}])"_json));
40
41
42 KO(
json_patch p1(R
"([{"op":"ad","path":"/0/renderable/bg","value":"Black"}])"_json));
43
44
45 KO(
json_patch p1(R
"([{"op":"add","path":"0/renderable/bg","value":"Black"}])"_json));
46
47 return 0;
48}
References nlohmann::json_patch::json_patch().