Skip to content

Commit

Permalink
Updated unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Jan 12, 2025
1 parent 8ea36e8 commit c3d8868
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Tests/BluetoothTests/BluetoothUUIDTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ import Bluetooth
let uuid = try #require(BluetoothUUID(rawValue: uuidString))

#if !os(WASI)
//#expect(uuid == .savantSystems2)
//#expect(uuid.name == "Savant Systems LLC")
//#expect("\(uuid)" == "FEA9 (Savant Systems LLC)", "\(uuid)")
#expect(uuid == BluetoothUUID.Member.savantSystems2)
#expect(uuid.metadata?.name == "Savant Systems LLC")
#expect("\(uuid)" == "FEA9 (Savant Systems LLC)")
#endif
#expect(uuid.rawValue == uuidString)
#expect(uuid.hashValue != 0)
Expand Down Expand Up @@ -167,7 +167,7 @@ import Bluetooth
let uuid = try #require(BluetoothUUID(rawValue: uuidString))

#if !os(WASI)
//#expect(uuid.name == nil)
#expect(uuid.metadata == nil)
#endif
#expect(uuid.rawValue == uuidString)
#expect(uuid.description == uuidString)
Expand Down
4 changes: 2 additions & 2 deletions Tests/BluetoothTests/GAPTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ import Bluetooth
let uuidList: GAPCompleteListOf16BitServiceClassUUIDs = [0x1803, 0x1804, 0x1802]
let localName: GAPCompleteLocalName = "Proximity"

#expect(uuidList.description == "[1803, 1804, 1802]")
#expect(uuidList.description == "[1803 (Link Loss), 1804 (Tx Power), 1802 (Immediate Alert)]")

let expectedData: [GAPData] = [flags, uuidList, localName]
let types = expectedData.map { type(of: $0) }
Expand Down Expand Up @@ -197,7 +197,7 @@ import Bluetooth
let uuidList: GAPIncompleteListOf16BitServiceClassUUIDs = [0x1803, 0x1804, 0x1802]
let localName: GAPCompleteLocalName = "Proximity"

#expect(uuidList.description == "[1803, 1804, 1802]")
#expect(uuidList.description == "[1803 (Link Loss), 1804 (Tx Power), 1802 (Immediate Alert)]")

let expectedData: [GAPData] = [flags, uuidList, localName]
let types = expectedData.map { type(of: $0) }
Expand Down
3 changes: 2 additions & 1 deletion Tests/BluetoothTests/GATTCharacteristicTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ import Bluetooth
(101 ... UInt8.max).forEach { #expect(GATTBatteryLevel(data: Data([$0])) == nil) }

// test percentage
#expect(GATTBatteryPercentage.unitType.description == "0x27AD (percentage)")
#expect(GATTBatteryPercentage.unitType.description == "percentage")
#expect(GATTBatteryPercentage.unitType.name == "percentage")
#expect(GATTBatteryPercentage.unitType.type == "org.bluetooth.unit.percentage")
#expect(GATTBatteryPercentage.unitType == .percentage)
(0 ... 100).forEach { #expect(GATTBatteryPercentage(rawValue: $0) != nil) }
Expand Down

0 comments on commit c3d8868

Please sign in to comment.