#include #include #include //#define private public #include #include #include #include #include using namespace mdd; using namespace httplib; TEST(ModuleHTTP, updateLayout_create){ Server svr; svr.Get("/inputs", [](const Request& req, Response& res) { json input_body; for (int i = 0; i < 5; ++i) { json entity; entity["type"] = "INPUT"; entity["value"] = i; input_body.push_back(entity); } std::cout<<"RECIVED: /inputs" <size(), // Content length [data](size_t offset, size_t length, DataSink &sink) { const auto &d = *data; sink.write(&d[offset], std::min(length, length)); return true; // return 'false' if you want to cancel the process. }, [data] { delete data; }); }); svr.Get("/outputs", [](const Request& req, Response& res) { json output_body; for (int i = 0; i < 3; ++i) { json entity; entity["type"] = "OUTPUT"; entity["value"] = i*2; output_body.push_back(entity); } std::cout<<"RECIVED: /outputs" <getValue()["value"].get(), i); } auto outputs_types = module.getOutputs(); auto outputs_ids = module.getOutputIDs(); for(int i = 0; i < 5; ++i){ EXPECT_EQ(outputs_types[i], "OUTPUT"); EXPECT_EQ(module.getOutput(outputs_ids[1])->getValue()["value"].get(), i*2); } }