Skip to content

Commit f29de38

Browse files
akash4chandranAkash CHANDRAN
andauthored
test: add unit tests for special numeric value encoding (NaN, Infinity) (#67)
* test: add unit tests for NaN and Infinity encoding * move special numeric tests into JToonTest * "test: update non-finite number test" * Delete JToonSpecialNumbersTest.java * Delete JToonTest.java --------- Co-authored-by: Akash CHANDRAN <[email protected]>
1 parent 4d2a20b commit f29de38

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/test/java/dev/toonformat/jtoon/JToonTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,9 +776,17 @@ void convertsNull() {
776776
@Test
777777
@DisplayName("converts non-finite numbers to null")
778778
void convertsNonFiniteNumbers() {
779-
assertEquals("null", encode(Double.POSITIVE_INFINITY));
780-
assertEquals("null", encode(Double.NEGATIVE_INFINITY));
781-
assertEquals("null", encode(Double.NaN));
779+
String positive = encode(Double.POSITIVE_INFINITY);
780+
String negative = encode(Double.NEGATIVE_INFINITY);
781+
String nan = encode(Double.NaN);
782+
783+
assertNotNull(positive);
784+
assertNotNull(negative);
785+
assertNotNull(nan);
786+
787+
assertEquals("null", positive, "Positive Infinity should encode to null");
788+
assertEquals("null", negative, "Negative Infinity should encode to null");
789+
assertEquals("null", nan, "NaN should encode to null");
782790
}
783791
}
784792

0 commit comments

Comments
 (0)