blob: a7abac46391153e775c73193c72788707b10f055 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
/**
* Integrity test for representation of undefined numeric field values.
*
* @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
*/
public class NanNumberTestCase {
@Test
final void testIntValue() {
assertEquals(0, NanNumber.NaN.intValue());
}
@Test
final void testLongValue() {
assertEquals(0L, NanNumber.NaN.longValue());
}
@Test
final void testFloatValue() {
assertTrue(Float.isNaN(NanNumber.NaN.floatValue()));
}
@Test
final void testDoubleValue() {
assertTrue(Double.isNaN(NanNumber.NaN.doubleValue()));
}
@Test
final void testToString() {
assertEquals("", NanNumber.NaN.toString());
}
}
|