Sometimes, student code is not a complete program, such as a function, and parameters can be passed in testcase to control intput. If the student code is an expression, there is no way to control input. I teach primary and secondary schools and often have students write code snippets. For example:
Given the variable 'year', write an expression to determine if it is a leap year.
You can assign values to 'year' in pretestcase to control the input.