Myna/Tests/MynaTests/ExtensionTests.swift
Ada Freya 4d199a0bd2
Some checks failed
[REUSE] Code Quality / REUSE (push) Has been cancelled
[Swift] Code Quality / Swift ${{ matrix.swift }} on ${{ matrix.os }} (macos-latest) (push) Has been cancelled
[Swift] Code Quality / Swift ${{ matrix.swift }} on ${{ matrix.os }} (ubuntu-latest) (push) Has been cancelled
[Swift] Test / Swift ${{ matrix.swift }} on ${{ matrix.os }} (macos-latest) (push) Has been cancelled
[Swift] Test / Swift ${{ matrix.swift }} on ${{ matrix.os }} (ubuntu-latest) (push) Has been cancelled
chore: update copyright
2025-12-25 13:01:41 +05:30

31 lines
695 B
Swift

// SPDX-FileCopyrightText: 2024-2026 Neptuwunium <ada@chronovore.dev>
// SPDX-License-Identifier: EUPL-1.2
import Foundation
import Testing
@testable import Myna
struct IntExtensionTests {
@Test func alignN() async throws {
#expect(12.align(into: 16) == 16)
}
@Test func alignE() async throws {
#expect(32.align(into: 16) == 32)
}
@Test func alignZ() async throws {
#expect(0.align(into: 16) == 0)
}
}
struct DataExtensionTests {
@Test func xor() throws {
let data1 = Data([1, 2, 3, 4, 5, 6])
let data2 = Data([0x80, 0x80, 0x80, 0x80, 0x80, 0x80])
let expected = Data([0x81, 0x82, 0x83, 0x84, 0x85, 0x86])
#expect(data1.xor(other: data2).elementsEqual(expected))
}
}