Skip to content

Commit

Permalink
UNITSOFMEASUREMENT-118: Add Tests according to Spec Chapter 4
Browse files Browse the repository at this point in the history
  • Loading branch information
keilw committed Jan 31, 2016
1 parent 4bf9b1b commit 216f2a5
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>tec.units</groupId>
<artifactId>unit-tck</artifactId>
<version>0.7-SNAPSHOT</version>
<version>0.7</version>
<packaging>bundle</packaging>
<name>Units of Measurement TCK</name>
<url>http://github.com/unitsofmeasurement/unit-tck</url>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/tec/units/tck/TCKRunner.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Unit-API - Units of Measurement API for Java
* Copyright (c) 2005-2015, Jean-Marie Dautelle, Werner Keil, V2COM.
* Copyright (c) 2005-2016, Jean-Marie Dautelle, Werner Keil, V2COM.
*
* All rights reserved.
*
Expand Down Expand Up @@ -69,15 +69,15 @@
* Main class for executing the JSR 363 TCK.
*
* @author <a href="mailto:units@catmedia.us">Werner Keil</a>
* @version 0.6.1, December 28, 2015
* @version 0.7, January 31, 2016
*/
public class TCKRunner extends XmlSuite implements Tool, Versioned<String> {

/**
*
*/
private static final long serialVersionUID = 3189431432291353154L;
private static final String TCK_VERSION = "0.7-SNAPSHOT";
private static final String TCK_VERSION = "0.7";
public static final String SPEC_ID = "JSR 363";
public static final String SPEC_VERSION = "0.9.0";
private final Profile profile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void testQuantityOp2Multiply() {
*/
@SpecAssertion(section = "4.4.1.2", id = "4412-A2")
@Test(groups = {"core"}, description = "4.4.1.2 Ensure registered Quantity classes implement divide.")
public void testQuantityOp1Divide() {
public void testQuantityOp2Divide() {
for (Class type : TCKSetup.getConfiguration().getQuantityClasses()) {
TestUtils.testHasPublicMethod("Section 4.4.1.2", type, Quantity.class, "divide", Quantity.class);
}
Expand Down
19 changes: 10 additions & 9 deletions src/main/java/tec/units/tck/tests/unit/UnitInterfaceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ public void testUnit42121Shift() {
*/
@SpecAssertion(section = "4.2.1.2.1", id = "42121-A2")
@Test(groups = {"core"}, description = "4.2.1.2.1 Ensure the multiply() operation is implemented.")
public void testUnit42121MultiplyWithDouble() {
public void testUnit42121Multiply() {
for (@SuppressWarnings("rawtypes")
Class type : TCKSetup.getConfiguration().getUnitClasses()) {
TestUtils.testHasPublicMethod("Section 4.2.1.3", type, Unit.class, "multiply", double.class);
TestUtils.testHasPublicMethod("Section 4.2.1.2.1", type, Unit.class, "multiply", Unit.class);
}
}
}

/**
* Ensure the divide() operation is implemented.
Expand All @@ -181,19 +181,19 @@ public void testUnit42121Divide() {
* Ensure the multiply() operation is implemented.
*/
@SpecAssertion(section = "4.2.1.2.1", id = "42121-A4")
@Test(groups = {"core"}, description = "4.2.1.2.1 Ensure the multiply() operation is implemented.")
public void testUnit42121Multiply() {
@Test(groups = {"core"}, description = "4.2.1.2.1 Ensure the multiply(double) operation is implemented.")
public void testUnit42121MultiplyWithDouble() {
for (@SuppressWarnings("rawtypes")
Class type : TCKSetup.getConfiguration().getUnitClasses()) {
TestUtils.testHasPublicMethod("Section 4.2.1.2.1", type, Unit.class, "multiply", Unit.class);
TestUtils.testHasPublicMethod("Section 4.2.1.3", type, Unit.class, "multiply", double.class);
}
}

/**
* Ensure the divide() operation is implemented.
*/
@SpecAssertion(section = "4.2.1.2.1", id = "42121-A5")
@Test(groups = {"core"}, description = "4.2.1.2.1 Ensure the divide() operation is implemented.")
@Test(groups = {"core"}, description = "4.2.1.2.1 Ensure the divide(double) operation is implemented.")
public void testUnit42121DivideWithDouble() {
for (@SuppressWarnings("rawtypes")
Class type : TCKSetup.getConfiguration().getUnitClasses()) {
Expand All @@ -212,6 +212,7 @@ public void testUnit42121Alternate() {
TestUtils.testHasPublicMethod("Section 4.2.1.2.1", type, "alternate", true);
}
}

/**
* Ensure the pow() operation is implemented.
*/
Expand Down Expand Up @@ -239,7 +240,7 @@ public void testUnit42122Root() {
/**
* Ensure the transform() operation is implemented.
*/
@SpecAssertion(section = "4.2.1.2.2", id = "42122-A5")
@SpecAssertion(section = "4.2.1.2.2", id = "42122-A3")
@Test(groups = {"core"}, description = "4.2.1.2.2 Ensure the transform() operation is implemented.")
public void testUnit42122Transform() {
for (@SuppressWarnings("rawtypes")
Expand Down
46 changes: 44 additions & 2 deletions src/main/resources/test-audit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,55 @@
</assertion>
</group>
</section>
<section id="4.2.1.2" title="Operations on Units with same dimension as the operand">
<section id="4.2.1.2" title="Unit Operations">
<group>
<text>Algebraic Operations</text>
<text>Operations on Units with same dimension as the operand</text>
<assertion id="42121-A1">
<text>Ensure the shift() operation is implemented.
</text>
</assertion>
<assertion id="42121-A2">
<text>4.2.1.2.1 Ensure the multiply() operation is implemented.
</text>
</assertion>
<assertion id="42121-A3">
<text>4.2.1.2.1 Ensure the divide() operation is implemented.
</text>
</assertion>
<assertion id="42121-A4">
<text>4.2.1.2.1 Ensure the multiply() operation is implemented.
</text>
</assertion>
<assertion id="42121-A5">
<text>4.2.1.2.1 Ensure the divide(double) operation is implemented.
</text>
</assertion>
<assertion id="42121-A6">
<text>4.2.1.2.1 Ensure the alternate() operation is implemented.
</text>
</assertion>
</group>
<group>
<text>Operations on Units with different dimension as the operand</text>
<assertion id="42122-A1">
<text>4.2.1.2.2 Ensure the pow() operation is implemented.
</text>
</assertion>
<assertion id="42122-A2">
<text>4.2.1.2.1 Ensure the multiply() operation is implemented.
</text>
</assertion>
<assertion id="42122-A3">
<text>4.2.1.2.2 Ensure the transform() operation is implemented.
</text>
</assertion>
</group>
<group>
<text>Unary Operations on Units</text>
<assertion id="42123-A1">
<text>4.2.1.2.3 Ensure the inverse() operation is implemented.
</text>
</assertion>
</group>
</section>

Expand Down

0 comments on commit 216f2a5

Please sign in to comment.