Question Authors' Forum

custom checking C/C++ program student answer

Picture of Richard Lobb
Re: custom checking C/C++ program student answer
by Richard Lobb - Monday, 30 October 2017, 5:20 PM

If you use a Python-scripted C question as explained in the section on implementing new languages, you can perform any checks you like on the student's answer before compiling and running it.

We've recently developed a C question type scripted in Python that uses astyle for checking style and layout, the Python pycparser module for parsing the student's program (letting us do things like check for certain constructs being used and to limit the number of lines per function) and can optionally run the student's code with valgrind. I can let you have it if you like but frankly it's way too complicated (around 900 lines of Python) and I think you'd be better off developing your own question type that just does what you want.