package thb.jeanluc.adventure.io;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

class MusicLevelTest {

    @Test
    void gainIncreasesWithLevel() {
        assertThat(MusicLevel.LOW.gainDb()).isLessThan(MusicLevel.MEDIUM.gainDb());
        assertThat(MusicLevel.MEDIUM.gainDb()).isLessThan(MusicLevel.HIGH.gainDb());
    }

    @Test
    void isOnOnlyWhenNotOff() {
        assertThat(MusicLevel.OFF.isOn()).isFalse();
        assertThat(MusicLevel.LOW.isOn()).isTrue();
        assertThat(MusicLevel.MEDIUM.isOn()).isTrue();
        assertThat(MusicLevel.HIGH.isOn()).isTrue();
    }

    @Test
    void nextCyclesThroughAllAndWraps() {
        assertThat(MusicLevel.OFF.next()).isEqualTo(MusicLevel.LOW);
        assertThat(MusicLevel.LOW.next()).isEqualTo(MusicLevel.MEDIUM);
        assertThat(MusicLevel.MEDIUM.next()).isEqualTo(MusicLevel.HIGH);
        assertThat(MusicLevel.HIGH.next()).isEqualTo(MusicLevel.OFF);
    }
}
