Skip to content

void test_function(int* input)

CountrySideEngineer edited this page Dec 3, 2022 · 1 revision

void test_function(int* input) / Pointer is input.

This page describes the test driver code to test the method like void test_function(int* input), a method whose argument is pointer and it is input.
(A method with no return and an argument with a pointer.)

test driver code.

The test driver code in source file is like below:

TEST_F(test_function, test_function_001)
{
    int _input[100];
    int input = &_input;

    _input[0] = input_value_1;
    _input[1] = input_value_2;
    _input[2] = input_value_3;

    /*
     * Set stub output values if the test_function() has sub function.
     */

    test_function(input);    // Call test target function.

    /*
     * Check the result of target function execution with "ASSERT_EQ" macro of googletest.
     */
}

The array variable _input[100] is pointer variable entity.
The size of array is 100 and can not change.