//
//  DeviceModelNameResolverTests.swift
//  suixinkanTests
//

import XCTest
@testable import suixinkan

/// 设备型号解析测试。
final class DeviceModelNameResolverTests: XCTestCase {
    /// 测试常见硬件标识符能映射为可读型号。
    func testKnownIdentifiersMapToMarketingNames() {
        XCTAssertEqual(DeviceModelNameResolver.marketingName(forHardwareIdentifier: "iPhone10,3"), "iPhone X")
        XCTAssertEqual(DeviceModelNameResolver.marketingName(forHardwareIdentifier: "iPhone10,6"), "iPhone X")
        XCTAssertEqual(DeviceModelNameResolver.marketingName(forHardwareIdentifier: "iPhone12,1"), "iPhone 11")
        XCTAssertEqual(DeviceModelNameResolver.marketingName(forHardwareIdentifier: "iPhone16,2"), "iPhone 15 Pro Max")
    }

    /// 测试未知标识符不回退为内部代号。
    func testUnknownIdentifierUsesGenericFallback() {
        XCTAssertEqual(DeviceModelNameResolver.marketingName(forHardwareIdentifier: "iPhone99,9"), "iPhone")
        XCTAssertEqual(DeviceModelNameResolver.marketingName(forHardwareIdentifier: "iPad99,9"), "iPad")
    }
}
