diff options
author | Pauli <pauli@openssl.org> | 2022-01-10 01:10:34 +0100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-01-12 10:10:21 +0100 |
commit | 291c5b3e39f4c98e61cf7f65056fe49780d1f0ac (patch) | |
tree | 94aadafd53b93798e37a7e422c09fcc469383493 /test/params_conversion_test.c | |
parent | params: add error messages for built in param conversions (diff) | |
download | openssl-291c5b3e39f4c98e61cf7f65056fe49780d1f0ac.tar.xz openssl-291c5b3e39f4c98e61cf7f65056fe49780d1f0ac.zip |
test: check for properly raised errors during param conversion
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17440)
Diffstat (limited to 'test/params_conversion_test.c')
-rw-r--r-- | test/params_conversion_test.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/params_conversion_test.c b/test/params_conversion_test.c index 9422ef1473..01f940065b 100644 --- a/test/params_conversion_test.c +++ b/test/params_conversion_test.c @@ -194,7 +194,8 @@ static int param_conversion_test(const PARAM_CONVERSION *pc, int line) double d; if (!pc->valid_i32) { - if (!TEST_false(OSSL_PARAM_get_int32(pc->param, &i32))) { + if (!TEST_false(OSSL_PARAM_get_int32(pc->param, &i32)) + || !TEST_ulong_ne(ERR_get_error(), 0)) { TEST_note("unexpected valid conversion to int32 on line %d", line); return 0; } @@ -214,7 +215,8 @@ static int param_conversion_test(const PARAM_CONVERSION *pc, int line) } if (!pc->valid_i64) { - if (!TEST_false(OSSL_PARAM_get_int64(pc->param, &i64))) { + if (!TEST_false(OSSL_PARAM_get_int64(pc->param, &i64)) + || !TEST_ulong_ne(ERR_get_error(), 0)) { TEST_note("unexpected valid conversion to int64 on line %d", line); return 0; } @@ -234,7 +236,8 @@ static int param_conversion_test(const PARAM_CONVERSION *pc, int line) } if (!pc->valid_u32) { - if (!TEST_false(OSSL_PARAM_get_uint32(pc->param, &u32))) { + if (!TEST_false(OSSL_PARAM_get_uint32(pc->param, &u32)) + || !TEST_ulong_ne(ERR_get_error(), 0)) { TEST_note("unexpected valid conversion to uint32 on line %d", line); return 0; } @@ -254,7 +257,8 @@ static int param_conversion_test(const PARAM_CONVERSION *pc, int line) } if (!pc->valid_u64) { - if (!TEST_false(OSSL_PARAM_get_uint64(pc->param, &u64))) { + if (!TEST_false(OSSL_PARAM_get_uint64(pc->param, &u64)) + || !TEST_ulong_ne(ERR_get_error(), 0)) { TEST_note("unexpected valid conversion to uint64 on line %d", line); return 0; } @@ -274,7 +278,8 @@ static int param_conversion_test(const PARAM_CONVERSION *pc, int line) } if (!pc->valid_d) { - if (!TEST_false(OSSL_PARAM_get_double(pc->param, &d))) { + if (!TEST_false(OSSL_PARAM_get_double(pc->param, &d)) + || !TEST_ulong_ne(ERR_get_error(), 0)) { TEST_note("unexpected valid conversion to double on line %d", line); return 0; } |