blob: c5cb280659adba961e90c857bc6c197e0a72c51c (
plain)
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
|
package market.guess.ui.desktop;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import market.guess.ui.desktop.util.Charts;
import org.junit.jupiter.api.Test;
class ChartsTest {
@Test
void testToEpochSecondFromIndex() {
double t0 = Charts.toEpochSecond(0);
double t1 = Charts.toEpochSecond(1);
double t2 = Charts.toEpochSecond(2);
assertEquals(Charts.BASE_TIME, t0, 1e-6);
assertEquals(Charts.BASE_TIME + 1800, t1, 1e-6);
assertEquals(Charts.BASE_TIME + 3600, t2, 1e-6);
}
@Test
void testToEpochSecondIdempotentForTimestamps() {
long epoch = 1_700_000_000L;
assertEquals(epoch, Charts.toEpochSecond(epoch), 1e-6);
}
@Test
void testBaseTimeIsReasonable() {
assertTrue(Charts.BASE_TIME > 1_700_000_000L);
}
}
|