Skip to content

Commit

Permalink
fix(tests)
Browse files Browse the repository at this point in the history
  • Loading branch information
zotovy committed May 5, 2022
1 parent 8787935 commit 9de640e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class AlgorithmUnitTest {

@Test
fun testAstronomical() {
test(DateTime.Morning, Twilight.Astronomical, 1549858363)
test(DateTime.Evening, Twilight.Astronomical, 1549907056)
test(DateTime.Morning, Twilight.Astronomical, 1549859430)
test(DateTime.Evening, Twilight.Astronomical, 1549905989)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,15 @@ import org.junit.Test
import java.time.Instant
import java.time.LocalDateTime
import java.time.ZoneOffset
import java.util.*

class SolarizedUnitTest {

private val date = Instant.ofEpochSecond(1549918775).atZone(ZoneOffset.UTC).toLocalDateTime()
private val latitude = 47.49801
private val longitude = 19.03991
private val solarized = Solarized(latitude, longitude, date)

// private fun test(time: DateTime, twilight: Twilight, expected: Long) {
//
// val expectedDate = Instant.ofEpochSecond(expected).atZone(ZoneOffset.UTC).toLocalDateTime()
//
//
// val actual = algorithm(
// time = time,
// twilight = twilight,
// date = date,
// latitude = latitude,
// longitude = longitude
// )
// Assert.assertEquals(expectedDate, actual)
// }
private val timeZone = TimeZone.getTimeZone("CEST")
private val solarized = Solarized(latitude, longitude, date, timeZone)

private fun getDate(epochSeconds: Long): LocalDateTime {
return Instant.ofEpochSecond(epochSeconds).atZone(ZoneOffset.UTC).toLocalDateTime()
Expand All @@ -35,9 +22,9 @@ class SolarizedUnitTest {
@Test
fun testList() {
val expected = SunPhaseList(
firstLight = SunPhase.FirstLight(date = getDate(1549858363)),
firstLight = SunPhase.FirstLight(date = getDate(1549859430)),
morningBlueHour = SunPhase.BlueHour(
start = getDate(1549862676),
start = getDate(1549861982),
end = getDate(1549863414),
),
sunrise = SunPhase.Sunrise(date = getDate(1549864601)),
Expand All @@ -56,9 +43,9 @@ class SolarizedUnitTest {
sunset = SunPhase.Sunset(date = getDate(1549900731)),
eveningBlueHour = SunPhase.BlueHour(
start = getDate(1549902009),
end = getDate(1549902746),
end = getDate(1549903439),
),
lastLight = SunPhase.LastLight(date = getDate(1549858363)),
lastLight = SunPhase.LastLight(date = getDate(1549859430)),
)

Assert.assertEquals(expected, solarized.list)
Expand Down

0 comments on commit 9de640e

Please sign in to comment.