diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-09-10 20:39:21 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-09-10 20:39:21 +0200 |
commit | a4456ca179fe154cfd797225c16d4baf011abaee (patch) | |
tree | 44ae471923121e3f85bbd8ef1258cd16a77d07bf /modules/codec/tests/data.cpp | |
parent | 6b761abbee4361571bd74e3deda9370ad94bd470 (diff) |
Changing return types on data functions
Diffstat (limited to 'modules/codec/tests/data.cpp')
-rw-r--r-- | modules/codec/tests/data.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/codec/tests/data.cpp b/modules/codec/tests/data.cpp new file mode 100644 index 0000000..816aa1c --- /dev/null +++ b/modules/codec/tests/data.cpp @@ -0,0 +1,32 @@ +#include <forstio/test/suite.hpp> +#include "../c++/data.hpp" + +namespace { +namespace sch { +using namespace saw::schema; + +using Int32Array = Array< + Int32 +>; +} + +SAW_TEST("Data Native/Array Access with Data Native"){ + using namespace saw; + + data<sch::Int32Array,encode::Native> prim{2u}; + prim.at(1u).set(0); + + data<schema::UInt64, encode::Native> i{1u}; + + auto& a = prim.at({i}); + + a.set(5); + + auto b = prim.at({i}); + b.set(10); + // Check if it's a reference being manipulated + SAW_EXPECT(a.get() == 5, "'a' has unexpected value."); + SAW_EXPECT(b.get() == 10, "'b' has unexpected value."); +} + +} |