Use TEST_EQUAL instead of TEST_ASSERT
Signed-off-by: Jethro Beekman <jethro@fortanix.com>
This commit is contained in:
parent
3477a672b9
commit
2593ec4bee
1 changed files with 6 additions and 6 deletions
|
@ -41,21 +41,21 @@ void mbedtls_pem_write_buffer_lengths()
|
|||
int ret;
|
||||
for (size_t l = 0; l <= sizeof(data); l++) {
|
||||
ret = mbedtls_pem_write_buffer("\n", "\n", data, l, NULL, 0, &olen_needed);
|
||||
TEST_ASSERT(ret == MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
|
||||
TEST_EQUAL(ret, MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
|
||||
|
||||
/* Test that a bigger buffer still only requires `olen_needed` */
|
||||
ret = mbedtls_pem_write_buffer("\n", "\n", data, l, buf, sizeof(buf), &olen);
|
||||
TEST_ASSERT(ret == 0);
|
||||
TEST_ASSERT(olen_needed == olen);
|
||||
TEST_EQUAL(ret, 0);
|
||||
TEST_EQUAL(olen_needed, olen);
|
||||
|
||||
/* Test that a buffer of exactly `olen_needed` works */
|
||||
memset(buf, 1, sizeof(buf));
|
||||
ret = mbedtls_pem_write_buffer("\n", "\n", data, l, buf, olen_needed, &olen);
|
||||
TEST_ASSERT(ret == 0);
|
||||
TEST_ASSERT(olen_needed == olen);
|
||||
TEST_EQUAL(ret, 0);
|
||||
TEST_EQUAL(olen_needed, olen);
|
||||
/* Test the function didn't overflow the given buffer */
|
||||
for (size_t i = olen_needed; i < sizeof(buf); i++) {
|
||||
TEST_ASSERT(buf[i] == 1);
|
||||
TEST_EQUAL(buf[i], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue