Skip to content

Commit

Permalink
add unit test for Facts with doubles.
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 721743322
  • Loading branch information
kluever authored and Google Java Core Libraries committed Jan 31, 2025
1 parent 07318c2 commit 31c254d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion core/src/test/java/com/google/common/truth/FactTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void twoFacts() {
}

@Test
public void numericFacts() {
public void numericFacts_integers() {
assertThat(
makeMessage(
ImmutableList.<String>of(),
Expand All @@ -80,6 +80,22 @@ public void numericFacts() {
"outside tolerance: 9,599"));
}

@Test
public void numericFacts_doubles() {
assertThat(
makeMessage(
ImmutableList.<String>of(),
ImmutableList.of(
fact("expected", 802604.123),
fact("but was", 773804.123),
fact("outside tolerance", 95.11111111))))
.isEqualTo(
TEXT.join(
"expected : 802604.123",
"but was : 773804.123",
"outside tolerance: 95.11111111"));
}

@Test
public void oneFactWithoutValue() {
assertThat(makeMessage(ImmutableList.<String>of(), ImmutableList.of(simpleFact("foo"))))
Expand Down

0 comments on commit 31c254d

Please sign in to comment.