SpoonLabs/nopol

different patch generated for the test-project

Closed this issue · 1 comments

When I try to repair the test-project using the command given by the README:

cd ../test-projects/
maven_repo=/home/dehengyang/environment/mavenRepo

java -jar /home/dehengyang/Nopol2018/nopol/nopol/target/nopol-0.2-SNAPSHOT-jar-with-dependencies.jar \
-s src/main/java/ \
-c target/classes:target/test-classes:${maven_repo}/junit/junit/4.11/junit-4.11.jar:${maven_repo}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar \
-t symbolic_examples.symbolic_example_1.NopolExampleTest \
-p ../nopol/lib/z3/z3_for_linux

Though the valid patch is generated as expected, I find that the patch generated in my computer is index < 0 rather than index =< 0 as addressed in the file.

The repair info is as follows:

18:01:23.473 [pool-1-thread-1] INFO fr.inria.lille.repair.nopol.NoPol - Nb SMT components: [4] [== of arity: 2, != of arity: 2, < of arity: 2, <= of arity: 2]
18:01:23.473 [pool-1-thread-1] INFO fr.inria.lille.repair.nopol.NoPol - class java.lang.Boolean: 4
18:01:23.473 [pool-1-thread-1] INFO fr.inria.lille.repair.nopol.NoPol - Nb variables in SMT : 16
18:01:23.474 [pool-1-thread-1] INFO fr.inria.lille.repair.nopol.NoPol - NoPol Execution time : 2346ms
18:01:23.474 [pool-1-thread-1] INFO fr.inria.lille.repair.nopol.NoPol -
18:01:23.474 [pool-1-thread-1] INFO fr.inria.lille.repair.nopol.NoPol - ----PATCH FOUND----
18:01:23.474 [pool-1-thread-1] INFO fr.inria.lille.repair.nopol.NoPol - index < 0
18:01:23.474 [pool-1-thread-1] INFO fr.inria.lille.repair.nopol.NoPol - Nb test that executes the patch: 9
18:01:23.474 [pool-1-thread-1] INFO fr.inria.lille.repair.nopol.NoPol - symbolic_examples.symbolic_example_1.NopolExample:12: CONDITIONAL
18:01:23.480 [pool-1-thread-1] INFO fr.inria.lille.repair.nopol.NoPol - --- a/src/main/java/symbolic_examples/symbolic_example_1/NopolExample.java
+++ b/src/main/java/symbolic_examples/symbolic_example_1/NopolExample.java
@@ -11,4 +11,4 @@

  • if ( index == 0 ) // Fix index <= 0
    
  • 	return s.charAt(0);
    
  • if ( index < 0) // Fix index <= 0
    
  • return s.charAt(0);
    

PATCH

My question is that: is it possible for nopol to generate the expected patch index <= 0?

and will the current patch that is different from the expected patch affect the patch quality for this test-project (buggy program)? I mean, is this patch a correct patch that is equivalent to the expected patch?

Thanks a lot.

My question is that: is it possible for nopol to generate the expected patch index <= 0?

Yes. By adding new test cases.