From 95145a733d15bef84aa294f31d5cf8cefc66a1e0 Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Fri, 2 Aug 2024 15:50:52 +0200 Subject: wip --- modules/codec/tests/transport.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'modules/codec/tests') diff --git a/modules/codec/tests/transport.cpp b/modules/codec/tests/transport.cpp index cffee24..e24fae6 100644 --- a/modules/codec/tests/transport.cpp +++ b/modules/codec/tests/transport.cpp @@ -20,22 +20,24 @@ using TestStruct = Struct< } -SAW_TEST("KelSimple Struct write and read back"){ +SAW_TEST("Transport FixedLen Struct write and slice"){ using namespace saw; - ring_buffer buffer{2048u}; + return; + ring_buffer buff{2048u}; data native; - data simple; + data simple{heap(buff)}; - auto& tda = native.template get<"two_dim_array">(); - tda = {1,2}; + { + auto& tda = native.template get<"two_dim_array">(); + tda = {1,2}; - tda.at(0,0).set(5); - tda.at(0,1).set(3); - native.template get<"number">().set(410); - + tda.at(0,0).set(5); + tda.at(0,1).set(3); + native.template get<"number">().set(410); + } codec codec; auto eov = codec.encode(native, simple); @@ -43,15 +45,19 @@ SAW_TEST("KelSimple Struct write and read back"){ // Reset values native = {}; + simple = {heap(buff)}; + { + auto& tda = native.template get<"two_dim_array">(); + tda = {1,2}; - eov = codec.decode(simple, native); - SAW_EXPECT(eov.is_value(), "Decoding error"); + tda.at(0,0).set(2); + tda.at(0,1).set(4); + native.template get<"number">().set(709); + } - auto& dec_tda = native.template get<"two_dim_array">(); + auto eov = codec.encode(native, simple); + SAW_EXPECT(eov.is_value(), "Encoding error"); - SAW_EXPECT(dec_tda.at(0,0).get() == 5, "Incorrect Decoding in array 0,0"); - SAW_EXPECT(dec_tda.at(0,1).get() == 3, "Incorrect Decoding in array 0,1"); - SAW_EXPECT(native.template get<"number">().get() == 410, "Incorrect Decoding in number"); } } -- cgit v1.2.3