write test_found tests
This commit is contained in:
@@ -1,7 +1,28 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/string.h>
|
||||
#include <kunity.h>
|
||||
#include <kunity_test_finder.h>
|
||||
|
||||
|
||||
result_code_e kunity_module_runner_fake_test_function_ok(const ptr_output_functions_s output)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
EXPORT_SYMBOL(kunity_module_runner_fake_test_function_ok);
|
||||
|
||||
static size_t tmp_list_counter;
|
||||
static result_code_e assert_test_item(/* in */ const ptr_test_list_item_s test_list_item)
|
||||
{
|
||||
TEST_ASSERT_NOT_EQUAL(NULL, test_list_item);
|
||||
TEST_ASSERT_NOT_EQUAL(NULL, test_list_item->test);
|
||||
TEST_ASSERT_NOT_EQUAL(NULL, test_list_item->test->modul_name);
|
||||
TEST_ASSERT_NOT_EQUAL(NULL, test_list_item->test->name);
|
||||
TEST_ASSERT_NOT_EQUAL(NULL, test_list_item->test->test_function);
|
||||
tmp_list_counter--;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
KUNITY_TEST(test_find_test_null_argument)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(ERROR_NULL_ARGUMENT, find_tests(NULL));
|
||||
@@ -16,8 +37,28 @@ KUNITY_TEST(test_find_test_invalid_argument)
|
||||
}
|
||||
|
||||
KUNITY_TEST(test_find_test_found)
|
||||
{
|
||||
TEST_IGNORE();
|
||||
{
|
||||
test_query_s query ={ "kunity_module_runner_fake_test_function_ok", THIS_MODULE->name, NULL};
|
||||
TEST_ASSERT_EQUAL(OK, find_tests(&query));
|
||||
TEST_ASSERT_NOT_EQUAL(NULL, query.result_list);
|
||||
TEST_ASSERT_EQUAL(1, query.result_list->count);
|
||||
TEST_ASSERT_NOT_EQUAL(NULL, query.result_list->head)
|
||||
TEST_ASSERT_NOT_EQUAL(NULL, query.result_list->head->test)
|
||||
TEST_ASSERT_EQUAL_STRING("test_kunity_test_runner_module", query.result_list->head->test->modul_name);
|
||||
TEST_ASSERT_EQUAL_STRING("kunity_module_runner_fake_test_function_ok", query.result_list->head->test->name);
|
||||
TEST_ASSERT_EQUAL(&kunity_module_runner_fake_test_function_ok, query.result_list->head->test->test_function);
|
||||
}
|
||||
|
||||
|
||||
KUNITY_TEST(test_find_tests_found)
|
||||
{
|
||||
test_query_s query ={ KUNITY_DEFAULT_TEST_NAME_FITER_STR, "*", NULL};
|
||||
TEST_ASSERT_EQUAL(OK, find_tests(&query));
|
||||
TEST_ASSERT_NOT_EQUAL(NULL, query.result_list);
|
||||
TEST_ASSERT_GREATER_OR_EQUAL(1, query.result_list->count);
|
||||
tmp_list_counter = query.result_list->count;
|
||||
TEST_ASSERT_EQUAL(OK,iterate_test_list(query.result_list, assert_test_item));
|
||||
TEST_ASSERT_EQUAL(0, tmp_list_counter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user