Skip to content

Commit

Permalink
Merge pull request #34 from FHIR/2023-07-gg-fix-tests
Browse files Browse the repository at this point in the history
2023 07 gg fix tests
  • Loading branch information
grahamegrieve authored Jul 17, 2023
2 parents 9411868 + c7644e7 commit 4c40a44
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
31 changes: 31 additions & 0 deletions src/test/java/org/fhir/ucum/UcumTestsIssue13.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.fhir.ucum;

import java.io.IOException;

import static org.junit.Assert.assertThrows;

import java.io.File;
import java.io.InputStream;
import java.io.FileInputStream;

import org.junit.Assert;
import org.junit.Test;

public class UcumTestsIssue13 {

@Test
public void testGigaYear() throws IOException, UcumException {

String fileName = "ucum-essence.xml";
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource(fileName).getFile());

InputStream inputStream = new FileInputStream(file);

UcumEssenceService ucumService = new UcumEssenceService(inputStream);
assertThrows(UcumException.class, () -> {
ucumService.convert(new Decimal("0.1"), "Ga", "a");
});
}

}
12 changes: 6 additions & 6 deletions src/test/resources/UcumFunctionalTests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@

<multiplication>
<!--
Given v1/u1, and v2/u2, multiply them together - should get something that is canonically equal
Given v1:u1, and v2:u2, multiply them together - should get something that is canonically equal
to vRes/uRes. Note that it doesn't have to be the same as vRes/uRes: the units
reported may differ in order or some other form, and the value may consequently
be different, but the result must convert to the stated value
Expand All @@ -703,14 +703,14 @@

<division>
<!--
Given v1*u1, and v2*u2, divide them - should get something that is canonically equal
to vRes*uRes. Note that it doesn't have to be the same as vRes*uRes: the units
Given v1:u1, and v2:u2, divide them - should get something that is canonically equal
to vRes:uRes. Note that it doesn't have to be the same as vRes:uRes: the units
reported may differ in order or some other form, and the value may consequently
be different, but the result must convert to the stated value
-->
<case id="4-101" v1="1.5" u1="g" v2="2" u2="m" vRes="0.75" uRes="g.m-1"/>
<case id="4-102" v1="2" u1="m" v2="1.5" u2="g" vRes="1.3333333333" uRes="g-1.m"/>
<case id="4-103" v1="1" u1="[lb_av]/h" v2="1" u2="kg/s" vRes="0.00012599803" uRes=""/> <!-- #19: u1, u2 are comparable, so uRes is unity -->
<case id="4-101" v1="1.5" u1="g" v2="2" u2="m" vRes="0.75" uRes="g.m-1"/>
<case id="4-102" v2="1.5" u2="g" v1="2" u1="m" vRes="1.3" uRes="g-1.m"/>
<case id="4-103" v1="1" u1="[lb_av]/h" v2="1" u2="kg/s" vRes="0.000125997880555555555555556" uRes=""/> <!-- #19: u1, u2 are comparable, so uRes is unity -->
</division>


Expand Down

0 comments on commit 4c40a44

Please sign in to comment.