diff options
author | Graham Leggett <minfrin@apache.org> | 2018-06-25 20:32:37 +0000 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2018-06-25 20:32:37 +0000 |
commit | 95ace400176cd8628e81976cb3c8801104dd6ea3 (patch) | |
tree | 2fd92e13a104da8fd34b40622e35663322bbec29 /test/testencode.c | |
parent | a8993f361be742c48b8ede4e326c9b773eda2495 (diff) | |
download | apr-95ace400176cd8628e81976cb3c8801104dd6ea3.tar.gz |
Add the apr_encode_* API that implements RFC4648 and RFC7515
compliant BASE64, BASE64URL, BASE32, BASE32HEX and BASE16
encode/decode functions.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1834371 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testencode.c')
-rw-r--r-- | test/testencode.c | 1117 |
1 files changed, 1117 insertions, 0 deletions
diff --git a/test/testencode.c b/test/testencode.c new file mode 100644 index 000000000..46e694954 --- /dev/null +++ b/test/testencode.c @@ -0,0 +1,1117 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> + +#include "apr_encode.h" +#include "apr_strings.h" + +#include "abts.h" +#include "testutil.h" + +static void test_encode_base64(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *src, *target; + const char *dest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + /* + * Test vectors from https://tools.ietf.org/html/rfc4648#section-10 + */ + src = ""; + target = ""; + dest = apr_pencode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "f"; + target = "Zg=="; + dest = apr_pencode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "f"; + target = "Zg"; + dest = apr_pencode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "fo"; + target = "Zm8="; + dest = apr_pencode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "fo"; + target = "Zm8"; + dest = apr_pencode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foo"; + target = "Zm9v"; + dest = apr_pencode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foo"; + target = "Zm9v"; + dest = apr_pencode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + apr_pool_destroy(pool); +} + +static void test_encode_base64_binary(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *target; + const unsigned char *usrc; + const char *dest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + /* + * Test vectors from https://tools.ietf.org/html/rfc4648#section-10 + */ + usrc = (unsigned char[]){ + }; + target = ""; + dest = apr_pencode_base64_binary(pool, usrc, 0, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f' + }; + target = "Zg=="; + dest = apr_pencode_base64_binary(pool, usrc, 1, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f' + }; + target = "Zg"; + dest = apr_pencode_base64_binary(pool, usrc, 1, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o' + }; + target = "Zm8="; + dest = apr_pencode_base64_binary(pool, usrc, 2, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o' + }; + target = "Zm8"; + dest = apr_pencode_base64_binary(pool, usrc, 2, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o' + }; + target = "Zm9v"; + dest = apr_pencode_base64_binary(pool, usrc, 3, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o' + }; + target = "Zm9v"; + dest = apr_pencode_base64_binary(pool, usrc, 3, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + apr_pool_destroy(pool); +} + +static void test_decode_base64(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *target, *src; + const char *dest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + /* + * Test vectors from https://tools.ietf.org/html/rfc4648#section-10 + */ + src = ""; + target = ""; + dest = apr_pdecode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, dest, target); + + src = "Zg=="; + target = "f"; + dest = apr_pdecode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, dest, target); + + src = "Zg"; + target = "f"; + dest = apr_pdecode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, dest, target); + + src = "Zm8="; + target = "fo"; + dest = apr_pdecode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, dest, target); + + src = "Zm8"; + target = "fo"; + dest = apr_pdecode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, dest, target); + + src = "Zm9v"; + target = "foo"; + dest = apr_pdecode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, dest, target); + + src = "Zm9v"; + target = "foo"; + dest = apr_pdecode_base64(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, dest, target); + + apr_pool_destroy(pool); +} + +static void test_decode_base64_binary(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *src; + const unsigned char *utarget; + const unsigned char *udest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + /* + * Test vectors from https://tools.ietf.org/html/rfc4648#section-10 + */ + src = ""; + utarget = (unsigned char[]){ + }; + udest = apr_pdecode_base64_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base64_binary target!=dest", memcmp(utarget, udest, 0) == 0); + ABTS_INT_EQUAL(tc, len, 0); + + src = "Zg=="; + utarget = (unsigned char[]){ + 'f' + }; + udest = apr_pdecode_base64_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base64_binary target!=dest", memcmp(utarget, udest, 1) == 0); + ABTS_INT_EQUAL(tc, len, 1); + + src = "Zg"; + utarget = (unsigned char[]){ + 'f' + }; + udest = apr_pdecode_base64_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base64_binary target!=dest", memcmp(utarget, udest, 1) == 0); + ABTS_INT_EQUAL(tc, len, 1); + + src = "Zm8="; + utarget = (unsigned char[]){ + 'f', 'o' + }; + udest = apr_pdecode_base64_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base64_binary target!=dest", memcmp(utarget, udest, 2) == 0); + ABTS_INT_EQUAL(tc, len, 2); + + src = "Zm8"; + utarget = (unsigned char[]){ + 'f', 'o' + }; + udest = apr_pdecode_base64_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base64_binary target!=dest", memcmp(utarget, udest, 2) == 0); + ABTS_INT_EQUAL(tc, len, 2); + + src = "Zm9v"; + utarget = (unsigned char[]){ + 'f', 'o', 'o' + }; + udest = apr_pdecode_base64_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base64_binary target!=dest", memcmp(utarget, udest, 3) == 0); + ABTS_INT_EQUAL(tc, len, 3); + + src = "Zm9v"; + utarget = (unsigned char[]){ + 'f', 'o', 'o' + }; + udest = apr_pdecode_base64_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base64_binary target!=dest", memcmp(utarget, udest, 3) == 0); + ABTS_INT_EQUAL(tc, len, 3); + + apr_pool_destroy(pool); +} + +static void test_encode_base32(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *src, *target; + const char *dest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + /* + * Test vectors from https://tools.ietf.org/html/rfc4648#section-10 + */ + src = ""; + target = ""; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "f"; + target = "MY======"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "f"; + target = "MY"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "f"; + target = "CO======"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "f"; + target = "CO"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "fo"; + target = "MZXQ===="; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "fo"; + target = "MZXQ"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "fo"; + target = "CPNG===="; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "fo"; + target = "CPNG"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foo"; + target = "MZXW6==="; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foo"; + target = "MZXW6"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foo"; + target = "CPNMU==="; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foo"; + target = "CPNMU"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foob"; + target = "MZXW6YQ="; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foob"; + target = "MZXW6YQ"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foob"; + target = "CPNMUOG="; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foob"; + target = "CPNMUOG"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "fooba"; + target = "MZXW6YTB"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "fooba"; + target = "MZXW6YTB"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "fooba"; + target = "CPNMUOJ1"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "fooba"; + target = "CPNMUOJ1"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foobar"; + target = "MZXW6YTBOI======"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foobar"; + target = "MZXW6YTBOI"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foobar"; + target = "CPNMUOJ1E8======"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "foobar"; + target = "CPNMUOJ1E8"; + dest = apr_pencode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + apr_pool_destroy(pool); +} + +static void test_encode_base32_binary(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *target; + const unsigned char *usrc; + const char *dest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + /* + * Test vectors from https://tools.ietf.org/html/rfc4648#section-10 + */ + usrc = (unsigned char[]){ + }; + target = ""; + dest = apr_pencode_base32_binary(pool, usrc, 0, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f' + }; + target = "MY======"; + dest = apr_pencode_base32_binary(pool, usrc, 1, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f' + }; + target = "MY"; + dest = apr_pencode_base32_binary(pool, usrc, 1, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f' + }; + target = "CO======"; + dest = apr_pencode_base32_binary(pool, usrc, 1, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f' + }; + target = "CO"; + dest = apr_pencode_base32_binary(pool, usrc, 1, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o' + }; + target = "MZXQ===="; + dest = apr_pencode_base32_binary(pool, usrc, 2, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o' + }; + target = "MZXQ"; + dest = apr_pencode_base32_binary(pool, usrc, 2, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o' + }; + target = "CPNG===="; + dest = apr_pencode_base32_binary(pool, usrc, 2, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o' + }; + target = "CPNG"; + dest = apr_pencode_base32_binary(pool, usrc, 2, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o' + }; + target = "MZXW6==="; + dest = apr_pencode_base32_binary(pool, usrc, 3, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o' + }; + target = "MZXW6"; + dest = apr_pencode_base32_binary(pool, usrc, 3, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o' + }; + target = "CPNMU==="; + dest = apr_pencode_base32_binary(pool, usrc, 3, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o' + }; + target = "CPNMU"; + dest = apr_pencode_base32_binary(pool, usrc, 3, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b' + }; + target = "MZXW6YQ="; + dest = apr_pencode_base32_binary(pool, usrc, 4, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b' + }; + target = "MZXW6YQ"; + dest = apr_pencode_base32_binary(pool, usrc, 4, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b' + }; + target = "CPNMUOG="; + dest = apr_pencode_base32_binary(pool, usrc, 4, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b' + }; + target = "CPNMUOG"; + dest = apr_pencode_base32_binary(pool, usrc, 4, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a' + }; + target = "MZXW6YTB"; + dest = apr_pencode_base32_binary(pool, usrc, 5, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a' + }; + target = "MZXW6YTB"; + dest = apr_pencode_base32_binary(pool, usrc, 5, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a' + }; + target = "CPNMUOJ1"; + dest = apr_pencode_base32_binary(pool, usrc, 5, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a' + }; + target = "CPNMUOJ1"; + dest = apr_pencode_base32_binary(pool, usrc, 5, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a', 'r' + }; + target = "MZXW6YTBOI======"; + dest = apr_pencode_base32_binary(pool, usrc, 6, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a', 'r' + }; + target = "MZXW6YTBOI"; + dest = apr_pencode_base32_binary(pool, usrc, 6, APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a', 'r' + }; + target = "CPNMUOJ1E8======"; + dest = apr_pencode_base32_binary(pool, usrc, 6, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + usrc = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a', 'r' + }; + target = "CPNMUOJ1E8"; + dest = apr_pencode_base32_binary(pool, usrc, 6, APR_ENCODE_BASE32HEX | APR_ENCODE_NOPADDING, &len); + ABTS_STR_EQUAL(tc, target, dest); + + apr_pool_destroy(pool); +} + +static void test_decode_base32(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *target, *src; + const char *dest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + /* + * Test vectors from https://tools.ietf.org/html/rfc4648#section-10 + */ + src = ""; + target = ""; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MY======"; + target = "f"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MY"; + target = "f"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CO======"; + target = "f"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CO"; + target = "f"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MZXQ===="; + target = "fo"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MZXQ"; + target = "fo"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CPNG===="; + target = "fo"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CPNG"; + target = "fo"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MZXW6==="; + target = "foo"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MZXW6"; + target = "foo"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CPNMU==="; + target = "foo"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CPNMU"; + target = "foo"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MZXW6YQ="; + target = "foob"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MZXW6YQ="; + target = "foob"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CPNMUOG="; + target = "foob"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CPNMUOG"; + target = "foob"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MZXW6YTB"; + target = "fooba"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MZXW6YTB"; + target = "fooba"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CPNMUOJ1"; + target = "fooba"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CPNMUOJ1"; + target = "fooba"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MZXW6YTBOI======"; + target = "foobar"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "MZXW6YTBOI"; + target = "foobar"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CPNMUOJ1E8======"; + target = "foobar"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + src = "CPNMUOJ1E8"; + target = "foobar"; + dest = apr_pdecode_base32(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_STR_EQUAL(tc, target, dest); + + apr_pool_destroy(pool); +} + +static void test_decode_base32_binary(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *src; + const unsigned char *utarget; + const unsigned char *udest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + /* + * Test vectors from https://tools.ietf.org/html/rfc4648#section-10 + */ + src = ""; + utarget = (unsigned char[]){ + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 0) == 0); + ABTS_INT_EQUAL(tc, 0, len); + + src = "MY======"; + utarget = (unsigned char[]){ + 'f' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 1) == 0); + ABTS_INT_EQUAL(tc, 1, len); + + src = "MY"; + utarget = (unsigned char[]){ + 'f' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 1) == 0); + ABTS_INT_EQUAL(tc, 1, len); + + src = "CO======"; + utarget = (unsigned char[]){ + 'f' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 1) == 0); + ABTS_INT_EQUAL(tc, 1, len); + + src = "CO"; + utarget = (unsigned char[]){ + 'f' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 1) == 0); + ABTS_INT_EQUAL(tc, 1, len); + + src = "MZXQ===="; + utarget = (unsigned char[]){ + 'f', 'o' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 2) == 0); + ABTS_INT_EQUAL(tc, 2, len); + + src = "MZXQ"; + utarget = (unsigned char[]){ + 'f', 'o' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 2) == 0); + ABTS_INT_EQUAL(tc, 2, len); + + src = "CPNG===="; + utarget = (unsigned char[]){ + 'f', 'o' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 2) == 0); + ABTS_INT_EQUAL(tc, 2, len); + + src = "CPNG"; + utarget = (unsigned char[]){ + 'f', 'o' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 2) == 0); + ABTS_INT_EQUAL(tc, 2, len); + + src = "MZXW6==="; + utarget = (unsigned char[]){ + 'f', 'o', 'o' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 3) == 0); + ABTS_INT_EQUAL(tc, 3, len); + + src = "MZXW6"; + utarget = (unsigned char[]){ + 'f', 'o', 'o' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 3) == 0); + ABTS_INT_EQUAL(tc, 3, len); + + src = "CPNMU==="; + utarget = (unsigned char[]){ + 'f', 'o', 'o' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 3) == 0); + ABTS_INT_EQUAL(tc, 3, len); + + src = "CPNMU"; + utarget = (unsigned char[]){ + 'f', 'o', 'o' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 3) == 0); + ABTS_INT_EQUAL(tc, 3, len); + + src = "MZXW6YQ="; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 4) == 0); + ABTS_INT_EQUAL(tc, 4, len); + + src = "MZXW6YQ="; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 4) == 0); + ABTS_INT_EQUAL(tc, 4, len); + + src = "CPNMUOG="; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 4) == 0); + ABTS_INT_EQUAL(tc, 4, len); + + src = "CPNMUOG"; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 4) == 0); + ABTS_INT_EQUAL(tc, 4, len); + + src = "MZXW6YTB"; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 5) == 0); + ABTS_INT_EQUAL(tc, 5, len); + + src = "MZXW6YTB"; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 5) == 0); + ABTS_INT_EQUAL(tc, 5, len); + + src = "CPNMUOJ1"; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 5) == 0); + ABTS_INT_EQUAL(tc, 5, len); + + src = "CPNMUOJ1"; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 5) == 0); + ABTS_INT_EQUAL(tc, 5, len); + + src = "MZXW6YTBOI======"; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a', 'r' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 6) == 0); + ABTS_INT_EQUAL(tc, 6, len); + + src = "MZXW6YTBOI"; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a', 'r' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 6) == 0); + ABTS_INT_EQUAL(tc, 6, len); + + src = "CPNMUOJ1E8======"; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a', 'r' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 6) == 0); + ABTS_INT_EQUAL(tc, 6, len); + + src = "CPNMUOJ1E8"; + utarget = (unsigned char[]){ + 'f', 'o', 'o', 'b', 'a', 'r' + }; + udest = apr_pdecode_base32_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_BASE32HEX, &len); + ABTS_ASSERT(tc, "apr_pdecode_base32_binary target!=dest", memcmp(utarget, udest, 6) == 0); + ABTS_INT_EQUAL(tc, 6, len); + + apr_pool_destroy(pool); +} + +static void test_encode_base16(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *src, *target; + const char *dest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + src = "foobar"; + target = "666f6f626172"; + dest = apr_pencode_base16(pool, src, APR_ENCODE_STRING, APR_ENCODE_LOWER, &len); + ABTS_STR_EQUAL(tc, target, dest); + apr_encode_base16(NULL, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, + apr_psprintf(pool, "size mismatch (%" APR_SIZE_T_FMT "!=%" APR_SIZE_T_FMT ")", len, strlen(dest) + 1), + (len == strlen(dest) + 1)); + + src = "foobar"; + target = "666F6F626172"; + dest = apr_pencode_base16(pool, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + apr_encode_base16(NULL, src, APR_ENCODE_STRING, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, + apr_psprintf(pool, "size mismatch (%" APR_SIZE_T_FMT "!=%" APR_SIZE_T_FMT ")", len, strlen(dest) + 1), + (len == strlen(dest) + 1)); + + src = "foobar"; + target = "66:6f:6f:62:61:72"; + dest = apr_pencode_base16(pool, src, APR_ENCODE_STRING, APR_ENCODE_COLON | APR_ENCODE_LOWER, &len); + ABTS_STR_EQUAL(tc, target, dest); + apr_encode_base16(NULL, src, APR_ENCODE_STRING, APR_ENCODE_COLON, &len); + ABTS_ASSERT(tc, + apr_psprintf(pool, "size mismatch (%" APR_SIZE_T_FMT "!=%" APR_SIZE_T_FMT ")", len, strlen(dest) + 1), + (len == strlen(dest) + 1)); + + src = "foobar"; + target = "66:6F:6F:62:61:72"; + dest = apr_pencode_base16(pool, src, APR_ENCODE_STRING, APR_ENCODE_COLON, &len); + ABTS_STR_EQUAL(tc, target, dest); + apr_encode_base16(NULL, src, APR_ENCODE_STRING, APR_ENCODE_COLON, &len); + ABTS_ASSERT(tc, + apr_psprintf(pool, "size mismatch (%" APR_SIZE_T_FMT "!=%" APR_SIZE_T_FMT ")", len, strlen(dest) + 1), + (len == strlen(dest) + 1)); + + apr_pool_destroy(pool); +} + +static void test_encode_base16_binary(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *target; + const unsigned char *usrc; + const char *dest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + usrc = (unsigned char[]){ + 0xFF, 0x00, 0xFF, 0x00 + }; + target = "ff00ff00"; + dest = apr_pencode_base16_binary(pool, usrc, 4, APR_ENCODE_LOWER, &len); + ABTS_STR_EQUAL(tc, target, dest); + apr_encode_base16_binary(NULL, usrc, 4, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, + apr_psprintf(pool, "size mismatch (%" APR_SIZE_T_FMT "!=%" APR_SIZE_T_FMT ")", len, strlen(dest) + 1), + (len == strlen(dest) + 1)); + + usrc = (unsigned char[]){ + 0xFF, 0x00, 0xFF, 0x00 + }; + target = "FF00FF00"; + dest = apr_pencode_base16_binary(pool, usrc, 4, APR_ENCODE_NONE, &len); + ABTS_STR_EQUAL(tc, target, dest); + apr_encode_base16_binary(NULL, usrc, 4, APR_ENCODE_NONE, &len); + ABTS_ASSERT(tc, + apr_psprintf(pool, "size mismatch (%" APR_SIZE_T_FMT "!=%" APR_SIZE_T_FMT ")", len, strlen(dest) + 1), + (len == strlen(dest) + 1)); + + usrc = (unsigned char[]){ + 0xFF, 0x00, 0xFF, 0x00 + }; + target = "ff:00:ff:00"; + dest = apr_pencode_base16_binary(pool, usrc, 4, APR_ENCODE_COLON | APR_ENCODE_LOWER, &len); + ABTS_STR_EQUAL(tc, target, dest); + apr_encode_base16_binary(NULL, usrc, 4, APR_ENCODE_COLON, &len); + ABTS_ASSERT(tc, + apr_psprintf(pool, "size mismatch (%" APR_SIZE_T_FMT "!=%" APR_SIZE_T_FMT ")", len, strlen(dest) + 1), + (len == strlen(dest) + 1)); + + usrc = (unsigned char[]){ + 0xFF, 0x00, 0xFF, 0x00 + }; + target = "FF:00:FF:00"; + dest = apr_pencode_base16_binary(pool, usrc, 4, APR_ENCODE_COLON, &len); + ABTS_STR_EQUAL(tc, target, dest); + apr_encode_base16_binary(NULL, usrc, 4, APR_ENCODE_COLON, &len); + ABTS_ASSERT(tc, + apr_psprintf(pool, "size mismatch (%" APR_SIZE_T_FMT "!=%" APR_SIZE_T_FMT ")", len, strlen(dest) + 1), + (len == strlen(dest) + 1)); + + apr_pool_destroy(pool); +} + +static void test_decode_base16(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *src, *target; + const char *dest; + apr_size_t len; + + apr_pool_create(&pool, NULL); + + src = "3A:3B:3C:3D"; + target = ":;<="; + dest = apr_pdecode_base16(pool, src, APR_ENCODE_STRING, APR_ENCODE_COLON, &len); + ABTS_STR_EQUAL(tc, target, dest); + ABTS_INT_EQUAL(tc, 4, (int)len); + apr_decode_base16(NULL, src, APR_ENCODE_STRING, APR_ENCODE_COLON, &len); + ABTS_ASSERT(tc, + apr_psprintf(pool, "size mismatch (%" APR_SIZE_T_FMT "!=%" APR_SIZE_T_FMT ")", len, (apr_size_t) 5), + (len == 5)); + + apr_pool_destroy(pool); +} + +static void test_decode_base16_binary(abts_case * tc, void *data) +{ + apr_pool_t *pool; + const char *src; + const unsigned char *utarget; + const unsigned char *udest; + apr_size_t len, vlen; + + apr_pool_create(&pool, NULL); + + src = "ff:00:ff:00"; + utarget = (unsigned char[]){ + 0xFF, 0x00, 0xFF, 0x00 + }; + udest = apr_pdecode_base16_binary(pool, src, APR_ENCODE_STRING, APR_ENCODE_COLON, &vlen); + ABTS_ASSERT(tc, "apr_pdecode_base16_binary target!=dest", memcmp(utarget, udest, 4) == 0); + ABTS_INT_EQUAL(tc, (int)vlen, 4); + apr_decode_base16_binary(NULL, src, APR_ENCODE_STRING, APR_ENCODE_COLON, &len); + ABTS_ASSERT(tc, + apr_psprintf(pool, "size mismatch (%" APR_SIZE_T_FMT "!=%" APR_SIZE_T_FMT ")", len, (apr_size_t) 4), + (len == 4)); + + apr_pool_destroy(pool); +} + +abts_suite *testencode(abts_suite * suite) +{ + suite = ADD_SUITE(suite); + + abts_run_test(suite, test_encode_base64, NULL); + abts_run_test(suite, test_encode_base64_binary, NULL); + abts_run_test(suite, test_decode_base64, NULL); + abts_run_test(suite, test_decode_base64_binary, NULL); + abts_run_test(suite, test_encode_base32, NULL); + abts_run_test(suite, test_encode_base32_binary, NULL); + abts_run_test(suite, test_decode_base32, NULL); + abts_run_test(suite, test_decode_base32_binary, NULL); + abts_run_test(suite, test_encode_base16, NULL); + abts_run_test(suite, test_encode_base16_binary, NULL); + abts_run_test(suite, test_decode_base16, NULL); + abts_run_test(suite, test_decode_base16_binary, NULL); + + return suite; +} |