1.0
This commit is contained in:
18
tests/json_smoke_test.cpp
Normal file
18
tests/json_smoke_test.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "dps/json.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
const dps::Json value = dps::Json::parse("{\"hello\":\"world\",\"n\":1,\"list\":[true,false]}");
|
||||
if (value["hello"].to_string_or("") != "world") {
|
||||
std::cerr << "json parse failed\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (value["n"].to_int_or(0) != 1) {
|
||||
std::cerr << "json number failed\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::cout << "json smoke test passed\n";
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user