|
| 1 | +//===----------------------------------------------------------------------===// |
| 2 | +// |
| 3 | +// This source file is part of the SwiftContainerPlugin open source project |
| 4 | +// |
| 5 | +// Copyright (c) 2024 Apple Inc. and the SwiftContainerPlugin project authors |
| 6 | +// Licensed under Apache License v2.0 |
| 7 | +// |
| 8 | +// See LICENSE.txt for license information |
| 9 | +// See CONTRIBUTORS.txt for the list of SwiftContainerPlugin project authors |
| 10 | +// |
| 11 | +// SPDX-License-Identifier: Apache-2.0 |
| 12 | +// |
| 13 | +//===----------------------------------------------------------------------===// |
| 14 | + |
| 15 | +import Foundation |
| 16 | +import Testing |
| 17 | + |
| 18 | +@testable import Tar |
| 19 | + |
| 20 | +let blocksize = 512 |
| 21 | +let headerLen = blocksize |
| 22 | +let trailerLen = 2 * blocksize |
| 23 | + |
| 24 | +@Suite struct TarUnitTests { |
| 25 | + @Test(arguments: [ |
| 26 | + (input: 0o000, expected: "000000"), |
| 27 | + (input: 0o555, expected: "000555"), |
| 28 | + (input: 0o750, expected: "000750"), |
| 29 | + (input: 0o777, expected: "000777"), |
| 30 | + (input: 0o1777, expected: "001777"), |
| 31 | + ]) |
| 32 | + func testOctal6(input: Int, expected: String) async throws { |
| 33 | + #expect(octal6(input) == expected) |
| 34 | + } |
| 35 | + |
| 36 | + @Test(arguments: [ |
| 37 | + (input: 0, expected: "00000000000"), |
| 38 | + (input: 1024, expected: "00000002000"), |
| 39 | + (input: 0o2000, expected: "00000002000"), |
| 40 | + (input: 1024 * 1024, expected: "00004000000"), |
| 41 | + ]) |
| 42 | + func testOctal11(input: Int, expected: String) async throws { |
| 43 | + #expect(octal11(input) == expected) |
| 44 | + } |
| 45 | +} |
0 commit comments