Skip to content

Commit ed34255

Browse files
fixup! [TMP] readapting cmake testing by using cloudutils
1 parent 8f06558 commit ed34255

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

extras/test/src/test_command_encode.cpp

+12-16
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ SCENARIO("Test the encoding of command messages") {
4343
// 01020304
4444
THEN("The encoding is successful") {
4545
REQUIRE(err == Encoder::Status::Complete);
46-
std::vector<uint8_t> res(buffer, buffer+res_len);
46+
std::vector<int> res(buffer, buffer+bytes_encoded);
4747

48-
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<uint8_t>{
48+
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<int>{
4949
0xda, 0x00, 0x01, 0x00, 0x00, 0x81, 0x58, 0x20,
5050
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
5151
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -80,9 +80,9 @@ SCENARIO("Test the encoding of command messages") {
8080

8181
THEN("The encoding is successful") {
8282
REQUIRE(err == Encoder::Status::Complete);
83-
std::vector<uint8_t> res(buffer, buffer+res_len);
83+
std::vector<int> res(buffer, buffer+bytes_encoded);
8484

85-
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<uint8_t>{
85+
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<int>{
8686
0xda, 0x00, 0x01, 0x03, 0x00, 0x81, 0x68, 0x74,
8787
0x68, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64
8888
}));
@@ -107,9 +107,9 @@ SCENARIO("Test the encoding of command messages") {
107107
// 80 # array(0)
108108
THEN("The encoding is successful") {
109109
REQUIRE(err == Encoder::Status::Complete);
110-
std::vector<uint8_t> res(buffer, buffer+res_len);
110+
std::vector<int> res(buffer, buffer+bytes_encoded);
111111

112-
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<uint8_t>{
112+
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<int>{
113113
0xda, 0x00, 0x01, 0x05, 0x00, 0x80
114114
}));
115115
}
@@ -138,9 +138,9 @@ SCENARIO("Test the encoding of command messages") {
138138
// 322E302E30 # "2.0.0"
139139
THEN("The encoding is successful") {
140140
REQUIRE(err == Encoder::Status::Complete);
141-
std::vector<uint8_t> res(buffer, buffer+res_len);
141+
std::vector<int> res(buffer, buffer+bytes_encoded);
142142

143-
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<uint8_t>{
143+
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<int>{
144144
0xda, 0x00, 0x01, 0x07, 0x00, 0x81, 0x65, 0x32,
145145
0x2e, 0x30, 0x2e, 0x30
146146
}));
@@ -178,9 +178,9 @@ SCENARIO("Test the encoding of command messages") {
178178
// 18 64 # unsigned(100)
179179
THEN("The encoding is successful") {
180180
REQUIRE(err == Encoder::Status::Complete);
181-
std::vector<uint8_t> res(buffer, buffer+res_len);
181+
std::vector<int> res(buffer, buffer+bytes_encoded);
182182

183-
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<uint8_t>{
183+
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<int>{
184184
0xda, 0x00, 0x01, 0x02, 0x00, 0x84, 0x50, 0x00,
185185
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
186186
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xe1,
@@ -202,18 +202,14 @@ SCENARIO("Test the encoding of command messages") {
202202
// CBORMessageEncoder encoder;
203203
Encoder::Status err = CBORMessageEncoder.encode((Message*)&command, buffer, bytes_encoded);
204204

205-
uint8_t expected_result[] = {
206-
0xda, 0x00, 0x01, 0x08, 0x00, 0x80
207-
};
208-
209205
// Test the encoding is
210206
// DA 00010800 # tag(67584)
211207
// 80 # array(0)
212208
THEN("The encoding is successful") {
213209
REQUIRE(err == Encoder::Status::Complete);
214-
std::vector<uint8_t> res(buffer, buffer+res_len);
210+
std::vector<int> res(buffer, buffer+bytes_encoded);
215211

216-
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<uint8_t>{
212+
REQUIRE_THAT(res, Catch::Matchers::Equals(std::vector<int>{
217213
0xda, 0x00, 0x01, 0x08, 0x00, 0x80
218214
}));
219215
}

0 commit comments

Comments
 (0)