Skip to content

Commit fb66729

Browse files
committed
fix coverage ci unit test
1 parent cfe492e commit fb66729

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

extras/test/src/test_provisioning_command_encode.cpp

+16-1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,22 @@
225225
}
226226
}
227227

228+
WHEN("Encode a message with provisioning public key")
229+
{
230+
ProvPublicKeyProvisioningMessage command;
231+
command.c.id = ProvisioningMessageId::ProvPublicKeyProvisioningMessageId;
232+
command.provPublicKey = "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE7JxCtXl5SvIrHmiasqyN4pyoXRlm44d5WXNpqmvJ\nk0tH8UpmIeHG7YPAkKLaqid95v/wLVoWeX5EbjxmlCkFtw==\n-----END PUBLIC KEY-----\n";
233+
uint8_t buffer[50];
234+
size_t bytes_encoded = sizeof(buffer);
235+
236+
CBORMessageEncoder encoder;
237+
MessageEncoder::Status err = encoder.encode((Message*)&command, buffer, bytes_encoded);
238+
239+
THEN("The encoding is failing") {
240+
REQUIRE(err == MessageEncoder::Status::Error);
241+
}
242+
}
243+
228244
WHEN("Encode a message with provisioning ble mac Address ")
229245
{
230246
BLEMacAddressProvisioningMessage command;
@@ -327,7 +343,6 @@
327343
// 81 # array(1)
328344
// 65 # text(5)
329345
// 312E362E30 # "1.6.0"
330-
printf("res %d\n", (int)err);
331346
THEN("The encoding is successful") {
332347
REQUIRE(err == MessageEncoder::Status::Complete);
333348
REQUIRE(bytes_encoded == sizeof(expected_result));

0 commit comments

Comments
 (0)