use of eu.stamp_project.dspot.amplifier.amplifiers.NullifierAmplifier in project dspot by STAMP-project.
the class NullifierAmplifierTest method test.
@Test
public void test() throws Exception {
// test the result of the NullifierAmplifier
final String nameMethod = "methodString";
CtClass<?> literalMutationClass = launcher.getFactory().Class().get("fr.inria.amp.LiteralMutation");
RandomHelper.setSeedRandom(42L);
Amplifier amplifier = new NullifierAmplifier();
final CtMethod method = findMethod(literalMutationClass, nameMethod);
List<CtMethod<?>> amplification = amplifier.amplify(method, 0).collect(Collectors.toList());
assertEquals(2, amplification.size());
amplification = amplification.stream().flatMap(testMethod -> amplifier.amplify(testMethod, 0)).collect(Collectors.toList());
assertEquals(2, amplification.size());
}
use of eu.stamp_project.dspot.amplifier.amplifiers.NullifierAmplifier in project dspot by STAMP-project.
the class NullifierAmplifierTest method testOnInteger.
@Test
public void testOnInteger() throws Exception {
// test the result of the NullifierAmplifier
final String nameMethod = "methodInteger";
CtClass<?> literalMutationClass = launcher.getFactory().Class().get("fr.inria.amp.LiteralMutation");
RandomHelper.setSeedRandom(42L);
Amplifier amplifier = new NullifierAmplifier();
final CtMethod method = findMethod(literalMutationClass, nameMethod);
List<CtMethod<?>> amplification = amplifier.amplify(method, 0).collect(Collectors.toList());
assertEquals(0, amplification.size());
}
use of eu.stamp_project.dspot.amplifier.amplifiers.NullifierAmplifier in project dspot by STAMP-project.
the class NullifierAmplifierTest method testOnArrayType.
@Test
public void testOnArrayType() throws Exception {
final String nameMethod = "methodThatClassmethodWithCharArray";
CtClass<?> literalMutationClass = launcher.getFactory().Class().get("fr.inria.amp.LiteralMutation");
RandomHelper.setSeedRandom(42L);
Amplifier amplifier = new NullifierAmplifier();
final CtMethod<?> method = findMethod(literalMutationClass, nameMethod);
List<CtMethod<?>> amplification = amplifier.amplify(method, 0).collect(Collectors.toList());
assertTrue(amplification.isEmpty());
}
use of eu.stamp_project.dspot.amplifier.amplifiers.NullifierAmplifier in project dspot by STAMP-project.
the class NullifierAmplifierTest method testOnIntegerMethodCall.
@Test
public void testOnIntegerMethodCall() throws Exception {
/*
test the result of the NullifierAmplifier: it can nullify non primitive type but not primitive
*/
final String nameMethod = "methodCall";
CtClass<?> literalMutationClass = launcher.getFactory().Class().get("fr.inria.amp.ClassWithMethodCall");
RandomHelper.setSeedRandom(42L);
Amplifier amplifier = new NullifierAmplifier();
final CtMethod method = findMethod(literalMutationClass, nameMethod);
List<CtMethod<?>> amplification = amplifier.amplify(method, 0).collect(Collectors.toList());
assertEquals(2, amplification.size());
amplification = amplification.stream().flatMap(testMethod -> amplifier.amplify(testMethod, 0)).collect(Collectors.toList());
assertEquals(2, amplification.size());
}
Aggregations