Files
HaishinKit.swift/RTMPHaishinKit/Tests/RTMP/RTMPVideoFourCCTests.swift
2025-07-13 12:43:53 +09:00

22 lines
719 B
Swift

import AVFoundation
import Foundation
import Testing
@testable import RTMPHaishinKit
@Suite struct RTMPVideoFourCCTests {
@Test func main() {
#expect("av01" == str4(n: Int(RTMPVideoFourCC.av1.rawValue)))
#expect("hvc1" == str4(n: Int(RTMPVideoFourCC.hevc.rawValue)))
#expect("vp09" == str4(n: Int(RTMPVideoFourCC.vp9.rawValue)))
}
func str4(n: Int) -> String {
var result = String(UnicodeScalar((n >> 24) & 255)?.description ?? "")
result.append(UnicodeScalar((n >> 16) & 255)?.description ?? "")
result.append(UnicodeScalar((n >> 8) & 255)?.description ?? "")
result.append(UnicodeScalar(n & 255)?.description ?? "")
return result
}
}