diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-01-08 19:03:09 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-01-08 19:03:09 +0100 |
| commit | 87db03e9ffa559eaf5f6b970ad42776f33ae34b2 (patch) | |
| tree | 08cb174ef076709c5a8d35c919a3554df532756b /modules/codec/tests | |
| parent | 043325c3a8ac3c4856a7b6944918e15cb7c36938 (diff) | |
| download | forstio-forstio-87db03e9ffa559eaf5f6b970ad42776f33ae34b2.tar.gz | |
dangling
Diffstat (limited to 'modules/codec/tests')
| -rw-r--r-- | modules/codec/tests/args.cpp | 2 | ||||
| -rw-r--r-- | modules/codec/tests/forst.cpp | 18 | ||||
| -rw-r--r-- | modules/codec/tests/print.cpp | 57 |
3 files changed, 75 insertions, 2 deletions
diff --git a/modules/codec/tests/args.cpp b/modules/codec/tests/args.cpp index f42056a..2b5b14c 100644 --- a/modules/codec/tests/args.cpp +++ b/modules/codec/tests/args.cpp @@ -40,7 +40,7 @@ SAW_TEST("Codec Args Decode Basic"){ codec<sch::Args<sch::ArgsStruct, sch::ArgsTuple>, encode::Args> args_codec; auto eov = args_codec.decode(dat_args, dat_nat); - SAW_EOV_EXPECT(eov, "Couldn't decode data. "); + SAW_EXPECT_EOV(eov, "Couldn't decode data"); auto& prog = dat_nat.template get<"program">(); auto& str = dat_nat.template get<"args">(); diff --git a/modules/codec/tests/forst.cpp b/modules/codec/tests/forst.cpp index 1d9c0c3..2bf6442 100644 --- a/modules/codec/tests/forst.cpp +++ b/modules/codec/tests/forst.cpp @@ -18,7 +18,7 @@ using TestStruct = Struct< using TestArray = Array< TestStruct >; - +/* SAW_TEST("Codec Forst Layer Info"){ using namespace saw; @@ -82,5 +82,21 @@ SAW_TEST("Codec Forst Primitive"){ SAW_EXPECT(val == foo, "Unexpected value"); } + +SAW_TEST("Codec Forst Struct of Primitives"){ + using namespace saw; + + data<TestStruct, encode::KelForst> test_dat; + + auto& test_a = test_dat.template get<"string">(); + auto& test_b = test_dat.template get<"number">(); + auto& test_c = test_dat.template get<"signed">(); + + test_b.set(50u); + test_c.set(-23); + test_a.set("cheese"); + +} +*/ } } diff --git a/modules/codec/tests/print.cpp b/modules/codec/tests/print.cpp new file mode 100644 index 0000000..695f7a0 --- /dev/null +++ b/modules/codec/tests/print.cpp @@ -0,0 +1,57 @@ +#include <forstio/test/suite.hpp> +#include "../c++/data_print.hpp" + +namespace { +namespace sch { +using namespace saw::schema; + +using TestStruct = Struct< + Member<Float64, "foo">, + Member<UInt64, "bar">, + Member<Int64, "baz">, + Member<String, "banana"> +>; +} + +/* +SAW_TEST("Math/Basic"){ + using namespace saw; + + data<sch::Vector<sch::Float64,2u>> a; + data<sch::Vector<sch::Float64,2u>> b; + + auto c = a + b; +} +*/ + +SAW_TEST("Data Print/Primitive Float64"){ + using namespace saw; + + + data<sch::Float64> a{40.1}; + + std::stringstream oss; + oss<<a; + + auto str = oss.str(); + SAW_EXPECT(str == std::string_view{"40.1"}, std::string{"Unexpected value: "} + str); +} + +SAW_TEST("Data Print/Struct"){ + using namespace saw; + + + data<sch::TestStruct> a; + + auto& banana = a.template get<"banana">(); + + banana.set("banned"); + + std::stringstream oss; + oss<<a; + + auto str = oss.str(); + std::cout<<str; + //SAW_EXPECT(str == std::string_view{"40.1"}, std::string{"Unexpected value: "} + str); +} +} |
