Skip to content

Commit

Permalink
Add dynamic array test
Browse files Browse the repository at this point in the history
  • Loading branch information
joajfreitas committed Jan 3, 2025
1 parent bb27997 commit ac7382a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions plugins/fcp_cpp/fcp_cpp/decoders.h.j2
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ class DynamicArray {
DynamicArray(): data_{} {}
DynamicArray(const std::vector<T>& value): data_{value} {}
DynamicArray(const char* value): data_{value} {}
DynamicArray(std::initializer_list<T> ls) : data_{ls} {}

static DynamicArray Decode(Buffer& buffer) {
std::vector<T> data{};
Expand Down
4 changes: 4 additions & 0 deletions tests/standardized/001_basic_values.fcp
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ struct S9 {
struct S10 {
s1 @ 0: [E, 4],
}

struct S11 {
s1 @ 0: [u8],
}
10 changes: 9 additions & 1 deletion tests/standardized/fcp_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,20 @@
"encoded": [1,0,2,0,3,0,4,0]
},
{
"name": "s10",
"name": "static_array_enum",
"datatype": "S10",
"decoded": {
"S10:s1": ["S1","S2","S0","S1"]
},
"encoded": [73]
},
{
"name": "dynamic_array_eight_bit",
"datatype": "S11",
"decoded": {
"S11:s1": ["0x0","0x1","0x2","0x3"]
},
"encoded": [4, 0, 0, 0, 0, 1, 2, 3]
}
]
}
Expand Down

0 comments on commit ac7382a

Please sign in to comment.