osb/source/test/serialization_test.cpp
2023-06-20 14:33:09 +10:00

29 lines
557 B
C++

#include "StarDataStreamDevices.hpp"
#include "gtest/gtest.h"
using namespace Star;
template <typename T>
void testMap(T const& map) {
auto byteArray = DataStreamBuffer::serializeMapContainer(map);
auto mapOut = DataStreamBuffer::deserializeMapContainer<T>(byteArray);
EXPECT_EQ(map, mapOut);
}
TEST(DataStreamTest, All) {
Map<int, int> map1 = {
{1, 2}, {3, 4}, {5, 6},
};
Map<String, int> map2 = {
{"asdf", 1}, {"asdf1", 2}, {"omg", 2},
};
Map<String, int> map3 = {};
testMap(map1);
testMap(map2);
testMap(map3);
}