Hello everyone,
First of all, thank you very much for this forum, which help me understanding this very good product.
We decided last week to choose, in our french company, to use CodeRunner to evaluate our atendees.
I'm very glad of that.
I never used such an automate, but i think that that marking someone only by the correctness of the printout is not sufficient to decide if he is able to create a good program. He can for example use a very badly constructed program, but which print in fact the good solution. He can take another easy way to do things, to avoid using lambda in Java for example, by replacing by a do loop.
I know that this question has already be set, but in another langage.
I would like to be sure, for example, that the student uses the Thread class.
I want him to write for example :
public class Programme{
public static void main(String args[]){
Test t = new Test();
t.start();
}
}
class Test extends Thread{
public void run() {
int i = 1;
System.out.println("From Thread" + i);
}
}
Then, i wrote a very short template using TWIG which is :
{% set cond1 = ('extends Thread' in STUDENT_ANSWER ) %}
{% if (cond1==true ) %}
{{STUDENT_ANSWER}}
{% else %}
public class Programme{
public static void main(String args[]){
System.err.println("Thread is not used in your program !");
System.exit(1);
}
}
{% endif %}
Is there an easier way to do what i want ?
and, what i would like to know about REGEX, is it possible to use REGEX so that patterns like
extends Thread
extends Thread
be accepted ?
I tried many possibilities like
{% if STUDENT_ANSWER matches '{^.+extends +Thread.+$}' %}
{% endif %}
But none works.It it the right way to try it in TWIG ?
Or does the code analysis has to be done with another langage independant of the langage to to compiled ?
Many thanks for all,
Pierre from Paris