package ru.dbotthepony.mc.otm.tests

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import ru.dbotthepony.mc.otm.core.math.integerDivisionDown
import ru.dbotthepony.mc.otm.core.math.integerDivisionUp

object MathTests {
	@Test
	@DisplayName("Integer divisions (round up and round down)")
	fun integerDivision() {
		assertEquals(0, integerDivisionDown(0, 9))
		assertEquals(0, integerDivisionDown(1, 9))
		assertEquals(0, integerDivisionDown(4, 9))
		assertEquals(0, integerDivisionDown(5, 9))
		assertEquals(0, integerDivisionDown(9, 9))
		assertEquals(1, integerDivisionDown(10, 9))
		assertEquals(1, integerDivisionDown(11, 9))
		assertEquals(1, integerDivisionDown(12, 9))
		assertEquals(1, integerDivisionDown(15, 9))
		assertEquals(1, integerDivisionDown(16, 9))
		assertEquals(1, integerDivisionDown(17, 9))
		assertEquals(1, integerDivisionDown(18, 9))
		assertEquals(2, integerDivisionDown(19, 9))

		assertEquals(0, integerDivisionUp(0, 9))
		assertEquals(1, integerDivisionUp(1, 9))
		assertEquals(1, integerDivisionUp(4, 9))
		assertEquals(1, integerDivisionUp(5, 9))
		assertEquals(1, integerDivisionUp(9, 9))
		assertEquals(2, integerDivisionUp(10, 9))
		assertEquals(2, integerDivisionUp(11, 9))
		assertEquals(2, integerDivisionUp(12, 9))
		assertEquals(2, integerDivisionUp(15, 9))
		assertEquals(2, integerDivisionUp(16, 9))
		assertEquals(2, integerDivisionUp(17, 9))
		assertEquals(2, integerDivisionUp(18, 9))
		assertEquals(3, integerDivisionUp(19, 9))
	}
}
