From b1cc0eb8eb25a991437a9d8bf06fe70131895779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Luis=20Vera=20P=C3=A9rez?= Date: Fri, 9 Jun 2017 15:24:31 +0200 Subject: [PATCH] Updated README.md file to show new PIT version and empty operator. --- README.md | 94 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 68 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 777a9b3..41d8549 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,31 @@ class A { } } ``` +### `empty` mutation operator + +This is a special operator which targets methods that return arrays. It replaces the entire body with a `return` statement that produces an empty array of the corresponding type. +For example, te following class: + +``` java +class A { + public int[] getRange(int count) { + int[] result = new int[count]; + for(int i=0; i < count; i++) { + result[i] = i; + } + return result; + } +} +``` +will become: + +``` java +class A { + public int[] getRange(int count) { + return new int[]; + } +} +``` ### Constant mutation operator: This operator accepts any method with primitive or `String` return type. It replaces the method body with a single instruction returning a defined constant. @@ -136,11 +161,11 @@ After installing the package, PIT should be configured to use Descartes. This st ### Maven Follow the [instructions](http://pitest.org/quickstart/maven/) to configure PIT for the project. Then specify `descartes` as the engine inside a `mutationEgine` tag in the `pom.xml` file: -```xml +``` xml org.pitest pitest-maven - 1.1.11 + 1.2.0 ... descartes @@ -150,7 +175,7 @@ Follow the [instructions](http://pitest.org/quickstart/maven/) to configure PIT ``` after this, add the artifact information as a dependency to PIT: -```xml +``` xml fr.inria.stamp descartes @@ -158,30 +183,47 @@ after this, add the artifact information as a dependency to PIT: ``` -An example of final configuration could be: +An example of a working configuration that uses all operators could be: -```xml +``` xml - org.pitest - pitest-maven - 1.1.11 - - descartes - - null - void - 0 - false - - - - - fr.inria.stamp - descartes - 0.2-SNAPSHOT - - - + org.pitest + pitest-maven + 1.2.0 + + descartes + + void + null + true + false + empty + 0 + 1 + (byte)0 + (byte)1 + (short)1 + (short)2 + 0L + 1L + 0.0 + 1.0 + 0.0f + 1.0f + '\40' + 'A' + "" + "A" + + + + + fr.inria.stamp + descartes + 0.2-SNAPSHOT + + + ``` With PIT and Descartes configured, just run the regular mutation coverage goal in the folder of the project under test: @@ -215,7 +257,7 @@ buildscript { configurations.maybeCreate("pitest") dependencies { - classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.1.11' + classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.2.0' pitest 'fr.inria.stamp:descartes:0.2-SNAPSHOT' } }