OpenVPN
test_misc.c File Reference
#include "syshead.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <setjmp.h>
#include <cmocka.h>
#include <siphash.h>
#include "ssl_util.h"
#include "options_util.h"
#include "test_common.h"
#include "list.h"
#include "mock_msg.h"
#include "crypto.h"
#include "sid_hash.h"
#include "win32-util.h"
#include "test_schedule.h"
Include dependency graph for test_misc.c:

Go to the source code of this file.

Data Structures

struct  word

Functions

static void test_compat_lzo_string (void **state)
static void test_auth_fail_temp_no_flags (void **state)
static void test_auth_fail_temp_flags (void **state)
static void test_auth_fail_temp_flags_msg (void **state)
static uint64_t word_hash_function (const void *key, const uint8_t hash_key[HASH_KEY_LEN])
static bool word_compare_function (const void *key1, const void *key2)
static struct hash_element * hash_lookup_by_value (struct hash *hash, const void *value)
static void test_list (void **state)
static void test_atoi_variants (void **state)
static void test_win_path_in_dir (void **state)
static void test_sid_hash_list (void **state)
int main (void)

Variables

const struct CMUnitTest misc_tests []

Function Documentation

◆ hash_lookup_by_value()

struct hash_element * hash_lookup_by_value ( struct hash * hash,
const void * value )
static

Definition at line 149 of file test_misc.c.

References hash_iterator_free(), hash_iterator_init(), hash_iterator_next(), and hash_element::value.

Referenced by test_list().

◆ main()

int main ( void )

Definition at line 568 of file test_misc.c.

References misc_tests, and openvpn_unit_test_setup().

◆ test_atoi_variants()

void test_atoi_variants ( void ** state)
static

◆ test_auth_fail_temp_flags()

void test_auth_fail_temp_flags ( void ** state)
static

◆ test_auth_fail_temp_flags_msg()

void test_auth_fail_temp_flags_msg ( void ** state)
static

Definition at line 115 of file test_misc.c.

References msg, parse_auth_failed_temp(), and options::server_backoff_time.

◆ test_auth_fail_temp_no_flags()

void test_auth_fail_temp_no_flags ( void ** state)
static

Definition at line 91 of file test_misc.c.

References msg, and parse_auth_failed_temp().

◆ test_compat_lzo_string()

void test_compat_lzo_string ( void ** state)
static

Definition at line 50 of file test_misc.c.

References gc, gc_free(), gc_new(), and options_string_compat_lzo().

◆ test_list()

◆ test_sid_hash_list()

◆ test_win_path_in_dir()

void test_win_path_in_dir ( void ** state)
static

Definition at line 465 of file test_misc.c.

References win_path_in_dir().

◆ word_compare_function()

bool word_compare_function ( const void * key1,
const void * key2 )
static

Definition at line 143 of file test_misc.c.

Referenced by test_list().

◆ word_hash_function()

uint64_t word_hash_function ( const void * key,
const uint8_t hash_key[HASH_KEY_LEN] )
static

Definition at line 135 of file test_misc.c.

References HASH_KEY_LEN, and siphash_hash_func().

Referenced by test_list().

Variable Documentation

◆ misc_tests

const struct CMUnitTest misc_tests[]
Initial value:
= {
cmocka_unit_test(test_win_path_in_dir),
cmocka_unit_test(test_compat_lzo_string),
cmocka_unit_test(test_auth_fail_temp_no_flags),
cmocka_unit_test(test_auth_fail_temp_flags),
cmocka_unit_test(test_auth_fail_temp_flags_msg),
cmocka_unit_test(test_list),
cmocka_unit_test(test_atoi_variants),
cmocka_unit_test(schedule_test),
cmocka_unit_test(test_sid_hash_list)
}
static void test_win_path_in_dir(void **state)
Definition test_misc.c:465
static void test_atoi_variants(void **state)
Definition test_misc.c:319
static void test_auth_fail_temp_flags(void **state)
Definition test_misc.c:102
static void test_compat_lzo_string(void **state)
Definition test_misc.c:50
static void test_list(void **state)
Definition test_misc.c:168
static void test_auth_fail_temp_no_flags(void **state)
Definition test_misc.c:91
static void test_sid_hash_list(void **state)
Definition test_misc.c:496
static void test_auth_fail_temp_flags_msg(void **state)
Definition test_misc.c:115
void schedule_test(void **state)
Runs the schedule test.

Definition at line 553 of file test_misc.c.

Referenced by main().