Skip to content

Commit 41ae861

Browse files
committed
test #451
1 parent 87f5475 commit 41ae861

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

ccu-historian-test/src/mdz/ccuhistorian/DatabaseTest.groovy

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,23 @@ class DatabaseTest {
88

99
@Test
1010
public void testFormatTimestamp() {
11-
// TODO:
12-
fail("Not yet implemented")
11+
def tests=[
12+
["2025-12-28", "2025-52", "2025"],
13+
["2025-12-29", "2026-01", "2025"],
14+
["2025-12-30", "2026-01", "2025"],
15+
["2025-12-31", "2026-01", "2025"],
16+
["2026-01-01", "2026-01", "2026"],
17+
18+
["2026-12-27", "2026-52", "2026"],
19+
["2026-12-28", "2026-53", "2026"],
20+
["2027-01-03", "2026-53", "2027"],
21+
["2027-01-04", "2027-01", "2027"],
22+
]
23+
tests.each {
24+
def (ds, yw, y)=it
25+
def d=Date.parse("yyyy-MM-dd", ds)
26+
assertEquals(yw, Database.formatTimestamp("%X-%W", d))
27+
assertEquals(y, Database.formatTimestamp("%Y", d))
28+
}
1329
}
1430
}

0 commit comments

Comments
 (0)