Skip to content

Commit cc0544a

Browse files
committed
Add DMP layer tests
1 parent 6bdca7b commit cc0544a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import XCTest
2+
@testable import sACNKit
3+
4+
final class DMPLayerTests: XCTestCase {
5+
6+
/// The test DMP Layer data.
7+
static let testDMPLayerData: Data = DMPLayer.createAsData(startCode: .perAddressPriority, values: [50] + Array(repeating: 0, count: 511))
8+
9+
/// Creates a DMP Layer.
10+
func testCreateDMPLayer() throws {
11+
let testLayer = Self.testDMPLayerData
12+
let expectedString = "720b02a1000000010201dd" + "32" + Array(repeating: "00", count: 511).joined()
13+
14+
XCTAssertEqual(testLayer.hexEncodedString(), expectedString)
15+
}
16+
17+
/// Replaces the values in a DMP Layer range.
18+
func testReplaceDMPLayerValuesRange() throws {
19+
var testLayer = Self.testDMPLayerData
20+
testLayer.replacingDMPLayerValues(with: [255, 254] + Array(repeating: 0, count: 510))
21+
let expectedString = "720b02a1000000010201dd" + "fffe" + Array(repeating: "00", count: 510).joined()
22+
23+
XCTAssertEqual(testLayer.hexEncodedString(), expectedString)
24+
}
25+
26+
}

0 commit comments

Comments
 (0)