mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-07 06:42:56 +03:00
Allow more signed integer types in test function arguments
Now that the C code supports the full range of intmax_t, allow any size of signed integer type in the .data file parser. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -31,6 +31,31 @@ exit:
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void printf_long_max(const char *format, long value)
|
||||
{
|
||||
char *expected = NULL;
|
||||
char *output = NULL;
|
||||
/* "0x" plus 2 hex digits per byte */
|
||||
const size_t n = sizeof(value) * 2;
|
||||
|
||||
/* We assume that long has no padding bits! */
|
||||
ASSERT_ALLOC(expected, n + 1);
|
||||
expected[0] = '7';
|
||||
memset(expected + 1, 'f', sizeof(value) * 2 - 1);
|
||||
|
||||
ASSERT_ALLOC(output, n + 1);
|
||||
TEST_EQUAL(n, mbedtls_snprintf(output, n + 1, format, value));
|
||||
ASSERT_COMPARE(expected, n + 1, output, n + 1);
|
||||
mbedtls_free(output);
|
||||
output = NULL;
|
||||
|
||||
exit:
|
||||
mbedtls_free(output);
|
||||
mbedtls_free(expected);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void printf_char2(char *format, int arg1, int arg2, char *result)
|
||||
{
|
||||
|
Reference in New Issue
Block a user