-
Notifications
You must be signed in to change notification settings - Fork 0
int test_function()
CountrySideEngineer edited this page Dec 3, 2022
·
1 revision
This page describes the test driver code to test the method like int test_function()
.
(A method with return value and no argument.)
The test driver code in source file is like below:
TEST_F(test_function, test_function_001)
{
int _ret_val;
/*
* Set stub output values if the test_function() has sub function.
*/
int _ret_val = test_function(); // Call test target function.
ASSET_EQ(expected_value, _ret_val);
/*
* Check the result of target function execution with "ASSERT_EQ" macro of googletest.
*/
}
The _ret_val
is a variable to set the value the test function returned, its name is fixed and can not change it.
The expected_value
in above code will be replaced by a value designed.