package de.arxsilex.maptools.converter.desktop

import kotlin.test.Test
import kotlin.test.assertFalse
import kotlin.test.assertTrue

class ExportResourcePolicyTest {
    private val gib = 1024L * 1024L * 1024L

    @Test
    fun `keeps map and poi sequential on memory constrained systems`() {
        val fourGiB = ExportResourcePolicy.from(8, 4 * gib, 3 * gib)
        val busySixteenGiB = ExportResourcePolicy.from(12, 16 * gib, 6 * gib)

        assertFalse(fourGiB.parallelMapsforgeOutputs)
        assertFalse(busySixteenGiB.parallelMapsforgeOutputs)
    }

    @Test
    fun `allows independent map and poi workers when cpu and memory are sufficient`() {
        val profile = ExportResourcePolicy.from(12, 32 * gib, 24 * gib)

        assertTrue(profile.parallelMapsforgeOutputs)
    }
}
