forked from ASSERT-KTH/flacoco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests that highlight ASSERT-KTH#67
Signed-off-by: André Silva <[email protected]>
- Loading branch information
1 parent
e4e3c34
commit f5706b4
Showing
6 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>fr.spoonlabs</groupId> | ||
<artifactId>FLtest1</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>FLtest1</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
26 changes: 26 additions & 0 deletions
26
examples/exampleFL10/FLtest1/src/main/java/fr/spoonlabs/FLtest1/Calculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package fr.spoonlabs.FLtest1; | ||
|
||
public class Calculator { | ||
|
||
public Calculator() { | ||
} | ||
|
||
public int calculate(String op, int op1, int op2) { | ||
|
||
while(true) { | ||
if (op.equals("+")) { | ||
return op1 + op2; | ||
} else if (op.equals("-")) { | ||
return op1 - op2; | ||
} else if (op.equals("*")) { | ||
return op1 / op2;//buggy | ||
} else if (op.equals("/")) { | ||
return op1 / op2; | ||
} else if (op.equals("%")) { | ||
return op1 % op2; | ||
} | ||
throw new UnsupportedOperationException(op); | ||
} | ||
|
||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
examples/exampleFL10/FLtest1/src/test/java/fr/spoonlabs/FLtest1/CalculatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package fr.spoonlabs.FLtest1; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
public class CalculatorTest { | ||
|
||
Calculator c = new Calculator(); | ||
|
||
@Test | ||
public void testSum() { | ||
|
||
assertEquals(4, c.calculate("+", 3, 1)); | ||
|
||
} | ||
|
||
@Test | ||
public void testSubs() { | ||
|
||
assertEquals(2, c.calculate("-", 3, 1)); | ||
|
||
} | ||
|
||
@Test | ||
public void testMul() { | ||
|
||
assertEquals(8, c.calculate("*", 4, 2)); | ||
|
||
} | ||
|
||
@Test | ||
public void testDiv() { | ||
|
||
assertEquals(2, c.calculate("/", 12, 6)); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters