Structural-Test: Improve structural test configuration
The following ideas should be evaluated.
- We are not able to enforce
output
andinput
. This should be implemented. Note that the error message should not list all possible functions! But state something like:Error: Your program should generate output! Please, read the exercise description very carefully!
- We are not able to define choices (e.g., you are allowed to use
printf
orfprintf
) - Define a minimum and a maximum number of occurrences for function calls.
- Define the maximal nesting depth.
- Define variable declarations.
main_file: ex.c
output: true # false -> 0 / null -> * / true -> +; default: null
input: false # false -> 0 / null -> * / true -> +; default: null
insecure: false # false -> 0 / null -> * / true -> +; default: null
recursion: false # false -> 0 / null -> 0 or 1 / true -> 1; default: null
function_calls:
items:
- choice: [fgets, sscanf, getline]
min: 1
max: 1
- name: fgets
min: 0
max: 1
- name: sscanf
min: 0
max: 1
- name: getline
min: 0
max: 1
- name: printf # function name
min: 1 # minimum number of calls of this function; default: 0
max: 2 # maximum number of calls of this function; default: *
other: 2 # number of function names not specified in 'calls'; default: *
min: 2 # minimum number total function calls; default: 0
max: 5 # maximum number total function calls; default: *
variable_declarations:
items:
- name: 'int x;'
min: 1
max: 2
other: false
min: 5
max: 9
keywords:
items:
- name: if
min: 1
max: 2
other: 0
min: 2
max: 6
max_nesting_depth: 5 # maximal nesting depth; default: *
required_functions:
- 'void letters_to_lower(char text[]);'
- 'void count_letter_occurrence(char text[], int letters[]);'
- 'void print_letter_occurrence(int letters[]);'
functions:
- function: print_letter_occurrence
output: true
- function: main
output: true