// // ScannerTests.swift // CBOR // // Created by Khan Winter on 8/24/25. // #if canImport(FoundationEssentials) import FoundationEssentials #else import Foundation #endif import Testing @testable import CBOR @Suite struct ScannerTests { @Test(arguments: [(24, 1), (25, 2), (26, 4), (27, 8)]) func int(argument: UInt8, byteCount: Int) throws { let data = Data([argument] + Array(repeating: UInt8.zero, count: byteCount)) try data.withUnsafeBytes { let data = $0[...] let scanner = CBORScanner(data: DataReader(data: data)) let results = try scanner.scan() let map = results.contents() #expect(map == [Int(MajorType.uint.bits | argument), 1, byteCount]) #expect(results.load(at: 0).type == .uint) #expect(results.load(at: 0).argument == argument) #expect(results.load(at: 0).count == byteCount) } } @Test(arguments: [(24, 1), (25, 2), (26, 4), (27, 8)]) func intInvalidSize(argument: UInt8, maxSize: Int) { for count in 0..