package ru.dbotthepony.kstarbound.test

import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import ru.dbotthepony.kommons.arrays.Int2DArray
import ru.dbotthepony.kstarbound.defs.dungeon.VectorizedBitSet
import ru.dbotthepony.kstarbound.util.random.random
import java.rmi.UnexpectedException

object MiscTests {
	@Test
	@DisplayName("Vectorized bit set test")
	fun vectorizedBitSet() {
		val random = random()
		val values = Int2DArray.allocate(16, 16)

		for (x in 0 until 16) {
			for (y in 0 until 16) {
				values[x, y] = random.nextInt(0, 4)
			}
		}

		val bits = VectorizedBitSet(4, 16, 16)

		for (x in 0 until 16) {
			for (y in 0 until 16) {
				bits[x, y] = values[x, y]
			}
		}

		for (x in 0 until 16) {
			for (y in 0 until 16) {
				assertEquals(values[x, y], bits[x, y])
			}
		}
	}
}
