import Testing
@testable import 康康

struct InferencePriorityTests {

    @Test func interactiveJumpsAheadOfBackground() {
        let idx = AIRuntime.gateInsertionIndex(of: .interactive,
                                               in: [.interactive, .background, .background])
        #expect(idx == 1)
    }

    @Test func interactiveKeepsFIFOAmongInteractive() {
        let idx = AIRuntime.gateInsertionIndex(of: .interactive,
                                               in: [.interactive, .interactive])
        #expect(idx == 2)
    }

    @Test func backgroundAlwaysAppends() {
        let idx = AIRuntime.gateInsertionIndex(of: .background,
                                               in: [.interactive, .background])
        #expect(idx == 2)
    }

    @Test func emptyQueueInsertsAtZero() {
        #expect(AIRuntime.gateInsertionIndex(of: .interactive, in: []) == 0)
        #expect(AIRuntime.gateInsertionIndex(of: .background, in: []) == 0)
    }
}
