Skip to content
Snippets Groups Projects

tests: replace ok(ret == KNOT_E???) with is_int(KNOT_E???, ret) to ease debugging

Merged Petr Špaček requested to merge tap_ok_to_isinst into master
All threads resolved!
Files
28
@@ -36,36 +36,36 @@ int main(int argc, char *argv[])
// 0. test invalid input
ret = base32hex_encode(NULL, 0, out, BUF_LEN);
ok(ret == KNOT_EINVAL, "base32hex_encode: NULL input buffer");
is_int(KNOT_EINVAL, ret, "base32hex_encode: NULL input buffer");
ret = base32hex_encode(in, BUF_LEN, NULL, 0);
ok(ret == KNOT_EINVAL, "base32hex_encode: NULL output buffer");
is_int(KNOT_EINVAL, ret, "base32hex_encode: NULL output buffer");
ret = base32hex_encode(in, MAX_BIN_DATA_LEN + 1, out, BUF_LEN);
ok(ret == KNOT_ERANGE, "base32hex_encode: input buffer too large");
is_int(KNOT_ERANGE, ret, "base32hex_encode: input buffer too large");
ret = base32hex_encode(in, BUF_LEN, out, BUF_LEN);
ok(ret == KNOT_ERANGE, "base32hex_encode: output buffer too small");
is_int(KNOT_ERANGE, ret, "base32hex_encode: output buffer too small");
ret = base32hex_encode_alloc(NULL, 0, &out3);
ok(ret == KNOT_EINVAL, "base32hex_encode_alloc: NULL input buffer");
is_int(KNOT_EINVAL, ret, "base32hex_encode_alloc: NULL input buffer");
ret = base32hex_encode_alloc(in, MAX_BIN_DATA_LEN + 1, &out3);
ok(ret == KNOT_ERANGE, "base32hex_encode_alloc: input buffer too large");
is_int(KNOT_ERANGE, ret, "base32hex_encode_alloc: input buffer too large");
ret = base32hex_encode_alloc(in, BUF_LEN, NULL);
ok(ret == KNOT_EINVAL, "base32hex_encode_alloc: NULL output buffer");
is_int(KNOT_EINVAL, ret, "base32hex_encode_alloc: NULL output buffer");
ret = base32hex_decode(NULL, 0, out, BUF_LEN);
ok(ret == KNOT_EINVAL, "base32hex_decode: NULL input buffer");
is_int(KNOT_EINVAL, ret, "base32hex_decode: NULL input buffer");
ret = base32hex_decode(in, BUF_LEN, NULL, 0);
ok(ret == KNOT_EINVAL, "base32hex_decode: NULL output buffer");
is_int(KNOT_EINVAL, ret, "base32hex_decode: NULL output buffer");
ret = base32hex_decode(in, UINT32_MAX, out, BUF_LEN);
ok(ret == KNOT_ERANGE, "base32hex_decode: input buffer too large");
is_int(KNOT_ERANGE, ret, "base32hex_decode: input buffer too large");
ret = base32hex_decode(in, BUF_LEN, out, 0);
ok(ret == KNOT_ERANGE, "base32hex_decode: output buffer too small");
is_int(KNOT_ERANGE, ret, "base32hex_decode: output buffer too small");
ret = base32hex_decode_alloc(NULL, 0, &out3);
ok(ret == KNOT_EINVAL, "base32hex_decode_alloc: NULL input buffer");
is_int(KNOT_EINVAL, ret, "base32hex_decode_alloc: NULL input buffer");
ret = base32hex_decode_alloc(in, UINT32_MAX, &out3);
ok(ret == KNOT_ERANGE, "base32hex_decode_aloc: input buffer too large");
is_int(KNOT_ERANGE, ret, "base32hex_decode_aloc: input buffer too large");
ret = base32hex_decode_alloc(in, BUF_LEN, NULL);
ok(ret == KNOT_EINVAL, "base32hex_decode_alloc: NULL output buffer");
is_int(KNOT_EINVAL, ret, "base32hex_decode_alloc: NULL output buffer");
// 1. test vector -> ENC -> DEC
strlcpy((char *)in, "", BUF_LEN);