19 lines
504 B
C++
19 lines
504 B
C++
#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;
|
|
}
|