How to Insert Coding Test Cases
Test cases in coding questions are used to automatically evaluate candidate solutions. TestTrick supports multiple input formats depending on the parameter type, including primitive types, 1D arrays, and 2D arrays.
Primitive Data Types
Integer
-
Whole numbers.
Example
10
String
- Text values.
-
Enter without quotes.
Example
hello
Double
-
Decimal or floating-point numbers.
Example
3.14
Multiple Parameters (New Line Separated)
Used when the function expects multiple individual parameters.
Example
12345
Each value must be on a new line.
Integer / String Array (1D Array)
For 1D arrays, use the following format:
- First line → array size
- Remaining lines → array values
Example
3100200300
Represents:
arr = [100, 200, 300]
Integer / String 2D Array
For 2D arrays, follow this format:
- First line → number of rows
- Second line → number of columns
- Remaining lines → values row-wise (each value on a new line)
Example
321 22 35 6
Represents:
arr = [[1, 2], [2, 3], [5, 6]]
Parameter Types Supported
TestTrick supports the following parameter types in coding test cases:
- Integer
- String
- Double
- Integer Array
- String Array
- Integer 2D Array
- String 2D Array
Each parameter must follow the exact input format for proper evaluation.
Important Notes
- Inputs must match the parameter type and format defined in the question.
- Test cases are matched exactly against expected outputs.
- Test case weightage contributes to the total score unless the question is unscorable.
Best Practices
- Mention input format expectations in the question description.
- Use multiple test cases to validate edge conditions.
- Ensure consistency across arrays and 2D arrays for correct evaluation.