Skip to content

Commit 87e2693

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

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/compile-examples.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- source-path: ./
3131
- name: Arduino_DebugUtils
3232
- source-url: https://github.com/fabik111/Arduino_ConnectionHandler.git
33-
version: 54b93d64da130f653fb437819c22fb89b78732d0
33+
version: 4f3731efa31f4889095e6191d212a98a3cc21a70
3434
- source-url: https://github.com/arduino-libraries/ArduinoBLE.git
3535
- source-url: https://github.com/arduino-libraries/Arduino_CloudUtils.git
3636
- source-url: https://github.com/arduino-libraries/Arduino_KVStore.git

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)