Merge branch 'main' into client-side-tests

This commit is contained in:
MihailRis 2026-07-07 18:53:27 +03:00
commit b4c8469264
5 changed files with 46 additions and 11 deletions

View file

@ -8,6 +8,8 @@ TEST(JSON, EncodeDecode) {
const int bytesSize = 20;
const int year = 2019;
const float score = 3.141592;
const double distance = 1.23e45;
const double epsilon = 1e-6;
const bool visible = true;
dv::objects::Bytes srcBytes(bytesSize);
for (int i = 0; i < bytesSize; i ++) {
@ -20,6 +22,8 @@ TEST(JSON, EncodeDecode) {
object["name"] = name;
object["year"] = year;
object["score"] = score;
object["distance"] = distance;
object["epsilon"] = epsilon;
object["visible"] = visible;
object["data"] = srcBytes;
@ -30,6 +34,8 @@ TEST(JSON, EncodeDecode) {
EXPECT_EQ(object["name"].asString(), name);
EXPECT_EQ(object["year"].asInteger(), year);
EXPECT_FLOAT_EQ(object["score"].asNumber(), score);
EXPECT_DOUBLE_EQ(object["distance"].asNumber(), distance);
EXPECT_DOUBLE_EQ(object["epsilon"].asNumber(), epsilon);
EXPECT_EQ(object["visible"].asBoolean(), visible);
auto b64string = object["data"].asString();

View file

@ -8,9 +8,13 @@ TEST(SmallHeap, Allocation) {
auto index = 0;
auto size = 4;
std::cout << "step 1" << std::endl;
SmallHeap<uint16_t, uint8_t> map;
std::cout << "step 2" << std::endl;
auto ptr = map.allocate(index, size);
std::cout << "ptr: " << (void*)ptr << " le2h(1): " << dataio::le2h(1) << " h2le(1): " << dataio::h2le(1) << std::endl;
EXPECT_EQ(map.sizeOf(ptr), size);
std::cout << "step 4" << std::endl;
EXPECT_EQ(ptr, map.find(index));
}