diff --git a/diffblue-base.json b/diffblue-base.json new file mode 100644 index 0000000..173e016 --- /dev/null +++ b/diffblue-base.json @@ -0,0 +1,21 @@ +{ + "phaseBase": { + "preferDepsJar": true, + "context-include": [ + "com.diffblue.javademo.", + "com.diffblue.annotation.", + "java.", + "org.cprover.", + "org.slf4j.helpers.MarkerIgnoringBase", + "org.slf4j.helpers.NamedLoggerBase", + "org.slf4j.helpers.NOPLogger", + "org.slf4j.ILoggerFactory", + "org.slf4j.Logger", + "org.slf4j.LoggerFactory", + "org.slf4j.Marker", + "sun.misc.", + "sun.nio.cs.", + "sun.util." + ] + } +} diff --git a/diffblue.yml b/diffblue.yml deleted file mode 100644 index 107ecbc..0000000 --- a/diffblue.yml +++ /dev/null @@ -1,5 +0,0 @@ -ignoreExistingCoverage: true -cbmcArguments: - # Because tic-tac-toe has 9 squares, we need to unwind the loops 10 times - # This will be auto-detected in a future version - max-nondet-array-length: 10 diff --git a/pom.xml b/pom.xml index c97c49a..6a77e9a 100644 --- a/pom.xml +++ b/pom.xml @@ -37,6 +37,37 @@ commons-codec 1.11 + + org.powermock + powermock-api-mockito + 1.6.6 + test + + + org.powermock + powermock-module-junit4 + 1.6.6 + test + + + org.mockito + mockito-all + 1.10.19 + test + + + com.diffblue + deeptestutils + 1.9.0 + test + + + org.jacoco + org.jacoco.agent + 0.8.4 + test + runtime + @@ -53,9 +84,13 @@ org.apache.maven.plugins maven-surefire-plugin - 2.22.1 + 3.0.0-M3 - false + -Djacoco-agent.destfile=${project.build.directory}/jacoco.exec + 0.5C + 600 + false + true @@ -80,6 +115,94 @@ + + org.apache.maven.plugins + maven-shade-plugin + 3.2.1 + + target/${project.artifactId}-${project.version}-with-dependencies.jar + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + package + + shade + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.4 + + + instrument + process-test-classes + + instrument + + + + restore-instrumented-classes + test + + restore-instrumented-classes + + + + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 3.0.0-M3 + + false + false + + + + + report + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.4 + + + + report + + + + + + diff --git a/src/main/java/com/diffblue/javademo/TrickyCases.java b/src/main/java/com/diffblue/javademo/TrickyCases.java new file mode 100644 index 0000000..769c835 --- /dev/null +++ b/src/main/java/com/diffblue/javademo/TrickyCases.java @@ -0,0 +1,55 @@ +package com.diffblue.javademo; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.Date; + +public class TrickyCases { + + /** + * Delete a file. + **/ + public static boolean deleteFile(String filename) throws IOException { + File file = new File("target"); + file.delete(); + return true; + } + + /** + * Open a file. + **/ + public static boolean openFile(String filename) throws IOException { + BufferedReader reader = new BufferedReader(new FileReader("target")); + String line; + while ((line = reader.readLine()) != null) { + } + reader.close(); + return true; + } + + /** + * Create a new file. + **/ + public static boolean createFile(String filename) throws IOException { + File file = new File("target"); + file.createNewFile(); + return true; + } + + /** + * Return a random number. + **/ + public static double random() { + return Math.random(); + } + + /** + * Return the current date. + **/ + public static Date now() { + return new Date(); + } + +}