Skip to content

Commit

Permalink
fixed the test case method name.
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Feb 1, 2025
1 parent 079289c commit bac26d2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions HaishinKit/Sources/RTMP/RTMPMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ struct RTMPSharedObjectMessage: RTMPMessage {
7.1.5. Audio Message (9)
*/
struct RTMPAudioMessage: RTMPMessage {
static let AAC_HEADER: UInt8 =
static let aacHeader: UInt8 =
RTMPAudioCodec.aac.rawValue << 4 |
RTMPSoundRate.kHz44.rawValue << 2 |
RTMPSoundSize.snd16bit.rawValue << 1 |
Expand Down Expand Up @@ -402,7 +402,7 @@ struct RTMPAudioMessage: RTMPMessage {
guard let config = AudioSpecificConfig(formatDescription: formatDescription) else {
return nil
}
var buffer = Data([Self.AAC_HEADER, RTMPAACPacketType.seq.rawValue])
var buffer = Data([Self.aacHeader, RTMPAACPacketType.seq.rawValue])
buffer.append(contentsOf: config.bytes)
self.payload = buffer
}
Expand All @@ -421,7 +421,7 @@ struct RTMPAudioMessage: RTMPMessage {
buffer.append(audioBuffer.data.assumingMemoryBound(to: UInt8.self), count: Int(audioBuffer.byteLength))
self.payload = buffer
default:
var buffer = Data([Self.AAC_HEADER, RTMPAACPacketType.raw.rawValue])
var buffer = Data([Self.aacHeader, RTMPAACPacketType.raw.rawValue])
buffer.append(audioBuffer.data.assumingMemoryBound(to: UInt8.self), count: Int(audioBuffer.byteLength))
self.payload = buffer
}
Expand Down
12 changes: 6 additions & 6 deletions HaishinKit/Tests/ISO/ESSpecificDataTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import Testing
@testable import HaishinKit

@Suite struct ESSpecificDataTests {
private let aacData = Data([15, 225, 1, 240, 6, 10, 4, 117, 110, 100, 0])
private let h264Data = Data([27, 225, 0, 240, 0, 15, 225, 1, 240, 6, 10, 4, 117, 110, 100, 0])
private let AACData = Data([15, 225, 1, 240, 6, 10, 4, 117, 110, 100, 0])
private let H264Data = Data([27, 225, 0, 240, 0, 15, 225, 1, 240, 6, 10, 4, 117, 110, 100, 0])

@Test func aACData() {
let data = ESSpecificData(aacData)
@Test func readAACData() {
let data = ESSpecificData(AACData)
#expect(data?.streamType == .adtsAac)
#expect(data?.elementaryPID == 257)
}

@Test func testh264Data() {
let data = ESSpecificData(h264Data)
@Test func readH264Data() {
let data = ESSpecificData(H264Data)
#expect(data?.streamType == .h264)
#expect(data?.elementaryPID == 256)
}
Expand Down
6 changes: 3 additions & 3 deletions HaishinKit/Tests/ISO/TSPacketTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import Testing
@Suite struct TSPacketTests {
static let dataWithMetadata: Data = .init([71, 64, 17, 16, 0, 66, 240, 37, 0, 1, 193, 0, 0, 0, 1, 255, 0, 1, 252, 128, 20, 72, 18, 1, 6, 70, 70, 109, 112, 101, 103, 9, 83, 101, 114, 118, 105, 99, 101, 48, 49, 167, 121, 160, 3, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255])

@Test func tSPacket() {
@Test func packet() {
let packetWithMetadata = TSPacket(data: TSPacketTests.dataWithMetadata)!
#expect(packetWithMetadata.syncByte == TSPacket.defaultSyncByte)
#expect(packetWithMetadata.pid == 17)
#expect(packetWithMetadata.data == TSPacketTests.dataWithMetadata)
}

@Test func tSProgramClockReference() {
@Test func programClockReference() {
let data = Data([0, 1, 66, 68, 126, 0])
let (b, e) = TSProgramClockReference.decode(data)
#expect(data == TSProgramClockReference.encode(b, e))
}

@Test func tSTimestamp() {
@Test func timestamp() {
#expect(0 == TSTimestamp.decode(Data([49, 0, 1, 0, 1])))
#expect(0 == TSTimestamp.decode(Data([17, 0, 1, 0, 1])))
#expect(Data([49, 0, 1, 0, 1]) == TSTimestamp.encode(0, TSTimestamp.ptsDtsMask))
Expand Down
4 changes: 2 additions & 2 deletions HaishinKit/Tests/ISO/TSProgramTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import Testing
static let dataForPAT: Data = .init([0, 0, 176, 13, 0, 1, 193, 0, 0, 0, 1, 240, 0, 42, 177, 4, 178])
static let dataForPMT: Data = .init([0, 2, 176, 29, 0, 1, 193, 0, 0, 225, 0, 240, 0, 27, 225, 0, 240, 0, 15, 225, 1, 240, 6, 10, 4, 117, 110, 100, 0, 8, 125, 232, 119])

@Test func pAT() {
@Test func pat() {
let pat = TSProgramAssociation(TSProgramTests.dataForPAT)!
#expect(pat.programs == [1: 4096])
#expect(pat.data == TSProgramTests.dataForPAT)
}

@Test func pMT() {
@Test func pmt() {
let pmt = TSProgramMap(TSProgramTests.dataForPMT)!
#expect(pmt.data == TSProgramTests.dataForPMT)
}
Expand Down
6 changes: 3 additions & 3 deletions HaishinKit/Tests/RTMP/AMFFoundationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import Testing
@Suite struct AMFFoundationTests {
static let hello: String = "<a>hello</a>"

@Test func aSArray() {
@Test func array() {
var array = AMFArray()
array[5] = "hoge"
if let array_5: String = array[5] as? String {
#expect(array_5 == "hoge")
}
}

@Test func aSXMLDocument() {
@Test func xmlDocument() {
let xml = AMFXMLDocument(data: AMFFoundationTests.hello)
#expect(xml.description == AMFFoundationTests.hello)
}

@Test func aSXML() {
@Test func xml() {
let xml = AMFXML(data: AMFFoundationTests.hello)
#expect(xml.description == AMFFoundationTests.hello)
}
Expand Down

0 comments on commit bac26d2

Please sign in to comment.