The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Functions | Variables
base_16_32_64_tests.c File Reference
#include <freeradius-devel/util/acutest.h>
#include <freeradius-devel/util/acutest_helpers.h>
#include "base16.h"
#include "base32.h"
#include "base64.h"
+ Include dependency graph for base_16_32_64_tests.c:

Go to the source code of this file.

Data Structures

struct  test_vector
 
struct  test_vector.cleartext
 
struct  test_vector.encoded
 

Functions

static void test_base16_decode (void)
 
static void test_base16_encode (void)
 
static void test_base32_decode (void)
 
static void test_base32_encode (void)
 
static void test_base32_hex_decode (void)
 
static void test_base32_hex_encode (void)
 
static void test_base64_decode (void)
 
static void test_base64_encode (void)
 

Variables

static const test_vector base16_vectors []
 
static const test_vector base32_hex_vectors []
 
static const test_vector base32_vectors []
 
static const test_vector base64_vectors []
 
 TEST_LIST
 

Data Structure Documentation

◆ test_vector

struct test_vector

Definition at line 8 of file base_16_32_64_tests.c.

Data Fields
struct test_vector cleartext
struct test_vector encoded

◆ test_vector.cleartext

struct test_vector.cleartext

Definition at line 9 of file base_16_32_64_tests.c.

Data Fields
size_t len
char const * str

◆ test_vector.encoded

struct test_vector.encoded

Definition at line 14 of file base_16_32_64_tests.c.

Data Fields
size_t len
char const * str

Function Documentation

◆ test_base16_decode()

static void test_base16_decode ( void  )
static

Definition at line 82 of file base_16_32_64_tests.c.

+ Here is the call graph for this function:

◆ test_base16_encode()

static void test_base16_encode ( void  )
static

Definition at line 61 of file base_16_32_64_tests.c.

+ Here is the call graph for this function:

◆ test_base32_decode()

static void test_base32_decode ( void  )
static

Definition at line 127 of file base_16_32_64_tests.c.

+ Here is the call graph for this function:

◆ test_base32_encode()

static void test_base32_encode ( void  )
static

Definition at line 105 of file base_16_32_64_tests.c.

+ Here is the call graph for this function:

◆ test_base32_hex_decode()

static void test_base32_hex_decode ( void  )
static

Definition at line 174 of file base_16_32_64_tests.c.

+ Here is the call graph for this function:

◆ test_base32_hex_encode()

static void test_base32_hex_encode ( void  )
static

Definition at line 152 of file base_16_32_64_tests.c.

+ Here is the call graph for this function:

◆ test_base64_decode()

static void test_base64_decode ( void  )
static

Definition at line 221 of file base_16_32_64_tests.c.

+ Here is the call graph for this function:

◆ test_base64_encode()

static void test_base64_encode ( void  )
static

Definition at line 199 of file base_16_32_64_tests.c.

+ Here is the call graph for this function:

Variable Documentation

◆ base16_vectors

const test_vector base16_vectors[]
static
Initial value:
= {
{ L(""), L("") },
{ L("f"), L("66") },
{ L("fo"), L("666f") },
{ L("foo"), L("666f6f") },
{ L("foob"), L("666f6f62") },
{ L("fooba"), L("666f6f6261") },
{ L("foobar"), L("666f6f626172") }
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition: build.h:207

Definition at line 21 of file base_16_32_64_tests.c.

◆ base32_hex_vectors

const test_vector base32_hex_vectors[]
static
Initial value:
= {
{ L(""), L("") },
{ L("f"), L("CO======") },
{ L("fo"), L("CPNG====") },
{ L("foo"), L("CPNMU===") },
{ L("foob"), L("CPNMUOG=") },
{ L("fooba"), L("CPNMUOJ1") },
{ L("foobar"), L("CPNMUOJ1E8======") }
}

Definition at line 41 of file base_16_32_64_tests.c.

◆ base32_vectors

const test_vector base32_vectors[]
static
Initial value:
= {
{ L(""), L("") },
{ L("f"), L("MY======") },
{ L("fo"), L("MZXQ====") },
{ L("foo"), L("MZXW6===") },
{ L("foob"), L("MZXW6YQ=") },
{ L("fooba"), L("MZXW6YTB") },
{ L("foobar"), L("MZXW6YTBOI======") }
}

Definition at line 31 of file base_16_32_64_tests.c.

◆ base64_vectors

const test_vector base64_vectors[]
static
Initial value:
= {
{ L(""), L("") },
{ L("f"), L("Zg==") },
{ L("fo"), L("Zm8=") },
{ L("foo"), L("Zm9v") },
{ L("foob"), L("Zm9vYg==") },
{ L("fooba"), L("Zm9vYmE=") },
{ L("foobar"), L("Zm9vYmFy") }
}

Definition at line 51 of file base_16_32_64_tests.c.

◆ TEST_LIST

TEST_LIST
Initial value:
= {
{ "base16_encode", test_base16_encode },
{ "base16_decode", test_base16_decode },
{ "base32_encode", test_base32_encode },
{ "base32_decode", test_base32_decode },
{ "base32_hex_encode", test_base32_hex_encode },
{ "base32_hex_decode", test_base32_hex_decode },
{ "base64.encode", test_base64_encode },
{ "base64.decode", test_base64_decode },
{ NULL }
}
static void test_base64_decode(void)
static void test_base64_encode(void)
static void test_base16_encode(void)
static void test_base32_hex_encode(void)
static void test_base32_encode(void)
static void test_base32_hex_decode(void)
static void test_base32_decode(void)
static void test_base16_decode(void)

Definition at line 246 of file base_16_32_64_tests.c.