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/print.cpp | |
| parent | 043325c3a8ac3c4856a7b6944918e15cb7c36938 (diff) | |
| download | forstio-forstio-87db03e9ffa559eaf5f6b970ad42776f33ae34b2.tar.gz | |
dangling
Diffstat (limited to 'modules/codec/tests/print.cpp')
| -rw-r--r-- | modules/codec/tests/print.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
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); +} +} |
