UEFIStarter
a simple UEFI framework
|
General assertions for tests. More...
#include <Uefi.h>
#include <Library/UefiLib.h>
Go to the source code of this file.
Functions | |
BOOLEAN | assert_true (BOOLEAN actual, CHAR16 *message) |
Asserts a boolean value is true. More... | |
BOOLEAN | assert_false (BOOLEAN actual, CHAR16 *message) |
Asserts a boolean value is false. More... | |
BOOLEAN | assert_intn_equals (INTN expected, INTN actual, CHAR16 *message) |
Asserts an integer value equals an expected value. More... | |
BOOLEAN | assert_intn_greater_than_or_equal_to (INTN expected, INTN actual, CHAR16 *message) |
Asserts an integer value is >=expectation . More... | |
BOOLEAN | assert_intn_less_than_or_equal_to (INTN expected, INTN actual, CHAR16 *message) |
Asserts an integer value is <=expectation . More... | |
BOOLEAN | assert_intn_in_closed_interval (INTN min, INTN max, INTN actual, CHAR16 *message) |
Asserts an integer value is within an interval: min <= input <= max . More... | |
BOOLEAN | assert_uint64_equals (UINT64 expected, UINT64 actual, CHAR16 *message) |
Asserts a UINT64 equals an expected value. More... | |
BOOLEAN | assert_double_near (double expected, double epsilon, double actual, CHAR16 *message) |
Asserts a double value is within an epsilon radius around an expected value. More... | |
BOOLEAN | assert_double_greater_than (double threshold, double actual, CHAR16 *message) |
Asserts a double value is >expectation . More... | |
BOOLEAN | assert_double_greater_than_or_equal_to (double threshold, double actual, CHAR16 *message) |
Asserts a double value is >=expectation . More... | |
BOOLEAN | assert_double_less_than (double threshold, double actual, CHAR16 *message) |
Asserts a double value is <expectation . More... | |
BOOLEAN | assert_double_less_than_or_equal_to (double threshold, double actual, CHAR16 *message) |
Asserts a double value is <=expectation . More... | |
BOOLEAN | assert_null (void *actual, CHAR16 *message) |
Asserts a pointer is NULL. More... | |
BOOLEAN | assert_not_null (void *actual, CHAR16 *message) |
Asserts a pointer is anything but NULL. More... | |
BOOLEAN | assert_uint8_array (UINTN size, UINT8 *expected, UINT8 *actual, CHAR16 *message) |
Asserts an array of UINT8 values matches an expected array's values. More... | |
BOOLEAN | assert_wcstr_equals (CHAR16 *expected, CHAR16 *actual, CHAR16 *message) |
Asserts a string equals an expected string. More... | |
BOOLEAN | assert_pixel (EFI_GRAPHICS_OUTPUT_BLT_PIXEL expected, EFI_GRAPHICS_OUTPUT_BLT_PIXEL actual, CHAR16 *message) |
Asserts an EFI_GRAPHICS_OUTPUT_BLT_PIXEL equals an expected pixel. More... | |
BOOLEAN | assert_pixel_values (UINT8 red, UINT8 green, UINT8 blue, UINT8 reserved, EFI_GRAPHICS_OUTPUT_BLT_PIXEL actual, CHAR16 *message) |
Asserts an EFI_GRAPHICS_OUTPUT_BLT_PIXEL has expected channel values. More... | |
BOOLEAN | assert_pixel_near (EFI_GRAPHICS_OUTPUT_BLT_PIXEL expected, INTN epsilon, EFI_GRAPHICS_OUTPUT_BLT_PIXEL actual, CHAR16 *message) |
Asserts an EFI_GRAPHICS_OUTPUT_BLT_PIXEL equals an expected pixel or the difference is within a given radius. More... | |
BOOLEAN | assert_pixel_values_near (UINT8 red, UINT8 green, UINT8 blue, UINT8 reserved, INTN epsilon, EFI_GRAPHICS_OUTPUT_BLT_PIXEL actual, CHAR16 *message) |
Asserts an EFI_GRAPHICS_OUTPUT_BLT_PIXEL has expected channel values or the difference is within a given radius. More... | |
Variables | |
BOOLEAN | invert_next_assert |
Inverts the next executed assertion: failure becomes success and vice versa. More... | |
General assertions for tests.
BOOLEAN assert_true | ( | BOOLEAN | actual, |
CHAR16 * | message | ||
) |
Asserts a boolean value is true.
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_false | ( | BOOLEAN | actual, |
CHAR16 * | message | ||
) |
Asserts a boolean value is false.
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_intn_equals | ( | INTN | expected, |
INTN | actual, | ||
CHAR16 * | message | ||
) |
Asserts an integer value equals an expected value.
expected | the expected value |
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_intn_greater_than_or_equal_to | ( | INTN | expected, |
INTN | actual, | ||
CHAR16 * | message | ||
) |
Asserts an integer value is >=expectation
.
expected | the expected value |
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_intn_less_than_or_equal_to | ( | INTN | expected, |
INTN | actual, | ||
CHAR16 * | message | ||
) |
Asserts an integer value is <=expectation
.
expected | the expected value |
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_intn_in_closed_interval | ( | INTN | min, |
INTN | max, | ||
INTN | actual, | ||
CHAR16 * | message | ||
) |
Asserts an integer value is within an interval: min <= input <= max
.
min | the smallest allowed value |
max | the largest allowed value |
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_uint64_equals | ( | UINT64 | expected, |
UINT64 | actual, | ||
CHAR16 * | message | ||
) |
Asserts a UINT64 equals an expected value.
expected | the expected value |
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_double_near | ( | double | expected, |
double | epsilon, | ||
double | actual, | ||
CHAR16 * | message | ||
) |
Asserts a double value is within an epsilon radius around an expected value.
To be exact this must hold true: expected-epsilon <= actual <= expected+epsilon
expected | the expected value |
epsilon | the highest absolute difference allowed |
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_double_greater_than | ( | double | threshold, |
double | actual, | ||
CHAR16 * | message | ||
) |
Asserts a double value is >expectation
.
threshold | the threshold the checked value must be higher than |
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_double_greater_than_or_equal_to | ( | double | threshold, |
double | actual, | ||
CHAR16 * | message | ||
) |
Asserts a double value is >=expectation
.
threshold | the lowest allowed value |
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_double_less_than | ( | double | threshold, |
double | actual, | ||
CHAR16 * | message | ||
) |
Asserts a double value is <expectation
.
threshold | the threshold the checked value must be lower than |
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_double_less_than_or_equal_to | ( | double | threshold, |
double | actual, | ||
CHAR16 * | message | ||
) |
Asserts a double value is <=expectation
.
threshold | the highest allowed value |
actual | the value to check |
message | an error message to include on failure |
BOOLEAN assert_null | ( | void * | actual, |
CHAR16 * | message | ||
) |
Asserts a pointer is NULL.
actual | the pointer to check |
message | an error message to include on failure |
BOOLEAN assert_not_null | ( | void * | actual, |
CHAR16 * | message | ||
) |
Asserts a pointer is anything but NULL.
actual | the pointer to check |
message | an error message to include on failure |
BOOLEAN assert_uint8_array | ( | UINTN | size, |
UINT8 * | expected, | ||
UINT8 * | actual, | ||
CHAR16 * | message | ||
) |
Asserts an array of UINT8 values matches an expected array's values.
size | the expected array size |
expected | the expected values |
actual | the values to check |
message | an error message to include on failure |
BOOLEAN assert_wcstr_equals | ( | CHAR16 * | expected, |
CHAR16 * | actual, | ||
CHAR16 * | message | ||
) |
Asserts a string equals an expected string.
expected | the expected string |
actual | the string to check |
message | an error message to include on failure |
BOOLEAN assert_pixel | ( | EFI_GRAPHICS_OUTPUT_BLT_PIXEL | exp, |
EFI_GRAPHICS_OUTPUT_BLT_PIXEL | act, | ||
CHAR16 * | message | ||
) |
Asserts an EFI_GRAPHICS_OUTPUT_BLT_PIXEL equals an expected pixel.
This also checks the .Reserved channel.
exp | the expected pixel |
act | the pixel to check |
message | an error message to include on failure |
BOOLEAN assert_pixel_values | ( | UINT8 | red, |
UINT8 | green, | ||
UINT8 | blue, | ||
UINT8 | reserved, | ||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL | act, | ||
CHAR16 * | message | ||
) |
Asserts an EFI_GRAPHICS_OUTPUT_BLT_PIXEL has expected channel values.
red | the expected red color value |
green | the expected green color value |
blue | the expected blue color value |
reserved | the expected reserved color value |
act | the value to check |
message | an error message to include on failure |
BOOLEAN assert_pixel_near | ( | EFI_GRAPHICS_OUTPUT_BLT_PIXEL | exp, |
INTN | epsilon, | ||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL | act, | ||
CHAR16 * | message | ||
) |
Asserts an EFI_GRAPHICS_OUTPUT_BLT_PIXEL equals an expected pixel or the difference is within a given radius.
The difference between two pixels is calculated as the sum of absolute differences in each channel.
This also checks the .Reserved channel.
exp | the expected pixel |
epsilon | the highest absolute differences sum allowed |
act | the pixel to check |
message | an error message to include on failure |
BOOLEAN assert_pixel_values_near | ( | UINT8 | red, |
UINT8 | green, | ||
UINT8 | blue, | ||
UINT8 | reserved, | ||
INTN | epsilon, | ||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL | act, | ||
CHAR16 * | message | ||
) |
Asserts an EFI_GRAPHICS_OUTPUT_BLT_PIXEL has expected channel values or the difference is within a given radius.
The difference between two pixels is calculated as the sum of absolute differences in each channel.
red | the expected red color value |
green | the expected green color value |
blue | the expected blue color value |
reserved | the expected reserved color value |
epsilon | the highest absolute differences sum over all color channels allowed |
act | the pixel to check |
message | an error message to include on failure |
BOOLEAN invert_next_assert |
Inverts the next executed assertion: failure becomes success and vice versa.
This automatically gets reset to FALSE after one assertion, regardless of its result.