UEFIStarter
a simple UEFI framework
|
Tests for string functions. More...
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <UEFIStarter/core.h>
#include <UEFIStarter/tests/tests.h>
Data Structures | |
struct | wctype_testcase_t |
data structure for wctype_* function test cases More... | |
struct | ftowcs_testcase_t |
data type for test_ftowcs() test cases More... | |
struct | wcstof_testcase_t |
data structure for test_wcstof() test cases More... | |
struct | atoui64_testcase_t |
data type for test_atoui64() test cases More... | |
struct | sprint_status_testcase_t |
data type for test_sprint_status() test cases More... | |
Macros | |
#define | RUN_WCTYPE_TESTCASES(FUNC, CASES) _run_wctype_testcases(sizeof(CASES)/sizeof(wctype_testcase_t),CASES,FUNC); |
helper macro to run wctype_* test cases More... | |
#define | WCSTOF_EPSILON 0.0000001 |
margin of error for wcstof() tests | |
Functions | |
void | _run_wctype_testcases (UINTN count, wctype_testcase_t *cases, BOOLEAN(*func)(CHAR16 *)) |
Runs given test cases against given wctype_* function. More... | |
void | test_wctype_int () |
Makes sure wctype_int() works. More... | |
void | test_wctype_float () |
Makes sure wctype_float() works. More... | |
void | test_ftowcs () |
Makes sure ftowcs() works. More... | |
void | test_ftowcs_boundaries () |
Makes sure ftowcs() errors out if input exceeds value boundaries. More... | |
void | test_wcstof () |
Makes sure wcstof() works. More... | |
void | test_atoui64 () |
Makes sure atoui64() works. More... | |
void | test_sprint_status () |
Makes sure sprint_status() works. More... | |
void | test_memsprintf () |
Makes sure memsprintf() tracks the pool memory it reserves. More... | |
void | test_split_string () |
Makes sure split_string() works. More... | |
BOOLEAN | run_string_tests () |
Test runner for this group. More... | |
Variables | |
wctype_testcase_t | wctype_floatint_testcases [] |
common testcases for test_wctype_int() and test_wctype_float() More... | |
wctype_testcase_t | wctype_int_testcases [] |
testcases specific to test_wctype_int() More... | |
wctype_testcase_t | wctype_float_testcases [] |
testcases specific to test_wctype_float() More... | |
ftowcs_testcase_t | ftowcs_testcases [] |
test cases for test_ftowcs() More... | |
wcstof_testcase_t | wcstof_testcases [] |
test cases for test_wcstof() More... | |
atoui64_testcase_t | atoui64_testcases [] |
test cases for test_atoui64() More... | |
sprint_status_testcase_t | sprint_status_testcases [] |
test cases for test_sprint_status() More... | |
Tests for string functions.
#define RUN_WCTYPE_TESTCASES | ( | FUNC, | |
CASES | |||
) | _run_wctype_testcases(sizeof(CASES)/sizeof(wctype_testcase_t),CASES,FUNC); |
helper macro to run wctype_* test cases
FUNC | the function to test inputs against |
CASES | the test cases to run |
void _run_wctype_testcases | ( | UINTN | count, |
wctype_testcase_t * | cases, | ||
BOOLEAN(*)(CHAR16 *) | func | ||
) |
Runs given test cases against given wctype_* function.
count | the number of test cases |
cases | the test cases |
func | the function to test inputs against |
void test_wctype_int | ( | ) |
Makes sure wctype_int() works.
wctype_int() should fail NULL, empty strings and non-numeric strings
wctype_int() should pass positive and negative integers
wctype_int() should fail decimal numbers
void test_wctype_float | ( | ) |
Makes sure wctype_float() works.
wctype_float() should fail NULL, empty strings and non-numeric strings
wctype_float() should pass positive and negative integers
wctype_float() should pass positive and negative decimal numbers
wctype_float() should fail invalid number-like strings similar to decimals
void test_ftowcs | ( | ) |
void test_ftowcs_boundaries | ( | ) |
void test_wcstof | ( | ) |
void test_atoui64 | ( | ) |
void test_sprint_status | ( | ) |
Makes sure sprint_status() works.
sprint_status() includes the given function's name in the result
sprint_status() includes the raw EFI_STATUS code in the result
sprint_status() converts EFI_STATUS codes to readable messages in the result
void test_memsprintf | ( | ) |
Makes sure memsprintf() tracks the pool memory it reserves.
void test_split_string | ( | ) |
Makes sure split_string() works.
split_string() returns 0 entries and writes NULL when requested to split a NULL string
split_string() splits a string by the given delimiter into the correct parts
split_string() includes empty string parts between delimiters
split_string() returns 1 entry and outputs the input string as array when requested to split an empty string
BOOLEAN run_string_tests | ( | ) |
Test runner for this group.
Gets called via the generated test runner.
wctype_testcase_t wctype_floatint_testcases[] |
common testcases for test_wctype_int() and test_wctype_float()
wctype_testcase_t wctype_int_testcases[] |
testcases specific to test_wctype_int()
wctype_testcase_t wctype_float_testcases[] |
testcases specific to test_wctype_float()
ftowcs_testcase_t ftowcs_testcases[] |
test cases for test_ftowcs()
wcstof_testcase_t wcstof_testcases[] |
test cases for test_wcstof()
atoui64_testcase_t atoui64_testcases[] |
test cases for test_atoui64()
sprint_status_testcase_t sprint_status_testcases[] |
test cases for test_sprint_status()