UEFIStarter
a simple UEFI framework
|
Tests for the command line parameter parser. More...
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
#include <UEFIStarter/core.h>
#include <UEFIStarter/tests/tests.h>
Data Structures | |
struct | cmdline_args_testcase_t |
data type for command-line argument parser testcase More... | |
struct | validate_range_testcase_t |
data type for command-line argument validator testcases More... | |
Functions | |
BOOLEAN | validate_int (cmdline_value_t val) |
A validator function for integers, used in tests. More... | |
void EFIAPI | do_parse_parameters_testcase (cmdline_args_testcase_t *testcase, cmdline_argument_t *list, UINTN count,...) |
Runs an individual testcase. More... | |
void | test_parse_parameters () |
Makes sure the command-line parser works. More... | |
void | test_validate_ranges () |
Makes sure the double and uint64 range validators work. More... | |
BOOLEAN | run_cmdline_tests () |
Test runner for this group. More... | |
Variables | |
cmdline_argument_t | cmdline_args_list [] |
A list of arguments, used in tests. More... | |
cmdline_argument_group_t | cmdline_args_group |
An argument group, used in tests. More... | |
cmdline_args_testcase_t | cmdline_args_testcases [] |
testcases for test_parse_parameters() More... | |
validate_range_testcase_t | double_range_testcases [] |
double test cases for test_validate_ranges More... | |
validate_range_testcase_t | uint64_range_testcases [] |
UINT64 test cases for test_validate_ranges. More... | |
Tests for the command line parameter parser.
BOOLEAN validate_int | ( | cmdline_value_t | val | ) |
A validator function for integers, used in tests.
val | the value to validate |
void EFIAPI do_parse_parameters_testcase | ( | cmdline_args_testcase_t * | testcase, |
cmdline_argument_t * | list, | ||
UINTN | count, | ||
... | |||
) |
Runs an individual testcase.
This currently doesn't really support multiple argument groups, the vararg setup is just there to convert the argument group to VA_LIST for parse_parameters().
testcase | the testcase to run |
list | the parsed argument's data |
count | the number of argument groups passed |
... | the list of argument groups (as cmdline_argument_group_t *) |
void test_parse_parameters | ( | ) |
Makes sure the command-line parser works.
not passing any parameters is OK
passing a parameter value a validator deems invalid results in parse failure
passing all valid values results in parse success
passing negative numbers to unsigned integer parameters results in parse failure
can supply logging parameters on command-line
void test_validate_ranges | ( | ) |
Makes sure the double and uint64 range validators work.
validate_double_range() and validate_uint64_range allow values only if they're in the closed interval between minimum and maximum
validate_double_range() and validate_uint64_range still work if minimum=maximum
BOOLEAN run_cmdline_tests | ( | ) |
Test runner for this group.
Gets called via the generated test runner.
cmdline_argument_t cmdline_args_list[] |
A list of arguments, used in tests.
cmdline_argument_group_t cmdline_args_group |
An argument group, used in tests.
cmdline_args_testcase_t cmdline_args_testcases[] |
testcases for test_parse_parameters()
validate_range_testcase_t double_range_testcases[] |
double test cases for test_validate_ranges
validate_range_testcase_t uint64_range_testcases[] |
UINT64 test cases for test_validate_ranges.