Jul 5th update

This commit is contained in:
Ned Wright
2023-07-05 23:32:39 +00:00
parent 22f1a984aa
commit a59f079ef7
85 changed files with 2488 additions and 1754 deletions

View File

@@ -99,6 +99,8 @@ TEST_F(RestConfigTest, alternative_port_used)
);
mainloop->run();
EXPECT_EQ(Singleton::Consume<I_RestApi>::from(rest_server)->getListeningPort(), *alternative_port);
sa.sin_port = htons(alternative_port.unpack());
EXPECT_EQ(bind(file_descriptor, reinterpret_cast<struct sockaddr *>(&sa), sizeof(struct sockaddr_in)), -1);

View File

@@ -19,6 +19,7 @@
#include <arpa/inet.h>
#include <sstream>
#include "customized_cereal_map.h"
#include "customized_cereal_multimap.h"
using namespace std;
@@ -175,6 +176,14 @@ class MustMapInt : public ServerRest
C2S_PARAM(mapStringInt, must_map_int);
};
class MustMultiMap : public ServerRest
{
void doCall() override {}
using mapStringInt = SerializableMultiMap<string, int>;
C2S_PARAM(mapStringInt, must_multimap);
};
TEST(RestSchema, must_map)
{
stringstream string_map_schema;
@@ -214,6 +223,32 @@ TEST(RestSchema, must_map)
" ]\n"
"}"
);
stringstream multi_map_schema;
MustMultiMap().performOutputingSchema(multi_map_schema);
EXPECT_EQ(
multi_map_schema.str(),
"{\n"
" \"properties\": {\n"
" \"must_multimap\": {\n"
" \"type\": \"object\",\n"
" \"additionalProperties\": {\n"
" \"anyOf\": [\n"
" {\n"
" \"type\": \"string\"\n"
" },\n"
" {\n"
" \"type\": \"integer\"\n"
" }\n"
" ]\n"
" }\n"
" }\n"
" },\n"
" \"required\": [\n"
" \"must_multimap\"\n"
" ]\n"
"}"
);
}
class MustObject : public ServerRest