OpenVPN
Macros | Functions
test_argv.c File Reference
#include "config.h"
#include "syshead.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <setjmp.h>
#include <cmocka.h>
#include <assert.h>
#include "argv.h"
#include "buffer.h"
Include dependency graph for test_argv.c:

Go to the source code of this file.

Macros

#define PATH1   "/s p a c e"
 
#define PATH2   "/foo bar/baz"
 
#define PARAM1   "param1"
 
#define PARAM2   "param two"
 
#define SCRIPT_CMD   "\"" PATH1 PATH2 "\"" PARAM1 "\"" PARAM2 "\""
 

Functions

int __wrap_parse_line (const char *line, char **p, const int n, const char *file, const int line_num, int msglevel, struct gc_arena *gc)
 
static void argv_printf__multiple_spaces_in_format__parsed_as_one (void **state)
 
static void argv_printf_cat__multiple_spaces_in_format__parsed_as_one (void **state)
 
static void argv_printf__combined_path_with_spaces__argc_correct (void **state)
 
static void argv_parse_cmd__command_string__argc_correct (void **state)
 
static void argv_parse_cmd__command_and_extra_options__argc_correct (void **state)
 
static void argv_printf_cat__used_twice__argc_correct (void **state)
 
static void argv_str__multiple_argv__correct_output (void **state)
 
static void argv_insert_head__empty_argv__head_only (void **state)
 
static void argv_insert_head__non_empty_argv__head_added (void **state)
 
int main (void)
 

Macro Definition Documentation

◆ PARAM1

#define PARAM1   "param1"

◆ PARAM2

#define PARAM2   "param two"

◆ PATH1

#define PATH1   "/s p a c e"

◆ PATH2

#define PATH2   "/foo bar/baz"

◆ SCRIPT_CMD

#define SCRIPT_CMD   "\"" PATH1 PATH2 "\"" PARAM1 "\"" PARAM2 "\""

Function Documentation

◆ __wrap_parse_line()

int __wrap_parse_line ( const char *  line,
char **  p,
const int  n,
const char *  file,
const int  line_num,
int  msglevel,
struct gc_arena gc 
)

Definition at line 24 of file test_argv.c.

References PARAM1, PARAM2, PATH1, and PATH2.

◆ argv_insert_head__empty_argv__head_only()

static void argv_insert_head__empty_argv__head_only ( void **  state)
static

◆ argv_insert_head__non_empty_argv__head_added()

static void argv_insert_head__non_empty_argv__head_added ( void **  state)
static

◆ argv_parse_cmd__command_and_extra_options__argc_correct()

static void argv_parse_cmd__command_and_extra_options__argc_correct ( void **  state)
static

Definition at line 85 of file test_argv.c.

References argv::argc, argv_new(), argv_parse_cmd(), argv_printf_cat(), argv_reset(), assert_int_equal, PATH1, and SCRIPT_CMD.

Referenced by main().

◆ argv_parse_cmd__command_string__argc_correct()

static void argv_parse_cmd__command_string__argc_correct ( void **  state)
static

Definition at line 74 of file test_argv.c.

References argv::argc, argv_new(), argv_parse_cmd(), argv_reset(), assert_int_equal, and SCRIPT_CMD.

Referenced by main().

◆ argv_printf__combined_path_with_spaces__argc_correct()

static void argv_printf__combined_path_with_spaces__argc_correct ( void **  state)
static

Definition at line 57 of file test_argv.c.

References argv::argc, argv_new(), argv_printf(), argv_reset(), assert_int_equal, PATH1, and PATH2.

Referenced by main().

◆ argv_printf__multiple_spaces_in_format__parsed_as_one()

static void argv_printf__multiple_spaces_in_format__parsed_as_one ( void **  state)
static

Definition at line 34 of file test_argv.c.

References argv::argc, argv_new(), argv_printf(), argv_reset(), assert_int_equal, PATH1, and PATH2.

Referenced by main().

◆ argv_printf_cat__multiple_spaces_in_format__parsed_as_one()

static void argv_printf_cat__multiple_spaces_in_format__parsed_as_one ( void **  state)
static

Definition at line 45 of file test_argv.c.

References argv::argc, argv_new(), argv_printf(), argv_printf_cat(), argv_reset(), assert_int_equal, PARAM1, PATH1, and PATH2.

Referenced by main().

◆ argv_printf_cat__used_twice__argc_correct()

static void argv_printf_cat__used_twice__argc_correct ( void **  state)
static

Definition at line 97 of file test_argv.c.

References argv::argc, argv_new(), argv_printf(), argv_printf_cat(), argv_reset(), assert_int_equal, PARAM1, PARAM2, PATH1, and PATH2.

Referenced by main().

◆ argv_str__multiple_argv__correct_output()

static void argv_str__multiple_argv__correct_output ( void **  state)
static

◆ main()

int main ( void  )