package solutions.tretter.mindmachine

import solutions.tretter.mindmachine.session.flashIntervalMsToSeconds
import solutions.tretter.mindmachine.session.flashIntervalSecondsToMs
import org.junit.Assert.assertEquals
import org.junit.Test

class FlashIntervalUiTest {
    @Test
    fun ms_to_seconds_conversion_is_correct() {
        assertEquals(0.05f, flashIntervalMsToSeconds(50), 0.0001f)
        assertEquals(0.167f, flashIntervalMsToSeconds(167), 0.0001f)
        assertEquals(2.0f, flashIntervalMsToSeconds(2000), 0.0001f)
    }

    @Test
    fun seconds_to_ms_conversion_rounds_to_nearest_int() {
        assertEquals(50, flashIntervalSecondsToMs(0.05f))
        assertEquals(167, flashIntervalSecondsToMs(0.167f))
        assertEquals(2000, flashIntervalSecondsToMs(2.0f))
    }
}
