package de.arxsilex.maptools.converter.core

import kotlin.test.Test
import kotlin.test.assertEquals

class MapsforgeProcessorPolicyTest {
    @Test
    fun `uses disk for materialized mapsforge sources regardless of compressed size`() {
        assertEquals(
            MapsforgeProcessorType.HD,
            MapsforgeProcessorPolicy.select(inputBytes = 68_433_685L, preferDiskProcessor = true),
        )
    }

    @Test
    fun `keeps size based selection for regular pbf sources`() {
        assertEquals(
            MapsforgeProcessorType.RAM,
            MapsforgeProcessorPolicy.select(
                inputBytes = MapsforgeProcessorPolicy.MAX_RAM_INPUT_BYTES,
                preferDiskProcessor = false,
            ),
        )
        assertEquals(
            MapsforgeProcessorType.HD,
            MapsforgeProcessorPolicy.select(
                inputBytes = MapsforgeProcessorPolicy.MAX_RAM_INPUT_BYTES + 1L,
                preferDiskProcessor = false,
            ),
        )
    }
}
