1515import XCTest
1616
1717final class TraceStateTests : XCTestCase {
18+ // MARK: - Creation
19+
20+ func test_create_empty_trace_state( ) {
21+ XCTAssertEqual ( TraceState . none. rawValue, " " )
22+ }
23+
1824 // MARK: - Equality
1925
20- func testNotEqualIfStorageCountDiffers( ) {
26+ func test_equal_sameStorage( ) {
27+ let lhs = TraceState ( [ ( " rojo " , " 00f067aa0ba902b7 " ) , ( " congo " , " t61rcWkgMzE " ) ] )
28+ let rhs = TraceState ( [ ( " rojo " , " 00f067aa0ba902b7 " ) , ( " congo " , " t61rcWkgMzE " ) ] )
29+
30+ XCTAssertEqual ( lhs, rhs)
31+ }
32+
33+ func test_not_equal_storageCountDiffers( ) {
2134 let lhs = TraceState ( [ ( " rojo " , " 00f067aa0ba902b7 " ) ] )
2235 let rhs = TraceState ( [ ( " rojo " , " 00f067aa0ba902b7 " ) , ( " congo " , " t61rcWkgMzE " ) ] )
2336
2437 XCTAssertNotEqual ( lhs, rhs)
2538 }
2639
27- func testNotEqualIfStorageOrderDiffers ( ) {
40+ func test_not_equal_storageOrderDiffers ( ) {
2841 let lhs = TraceState ( [ ( " congo " , " t61rcWkgMzE " ) , ( " rojo " , " 00f067aa0ba902b7 " ) ] )
2942 let rhs = TraceState ( [ ( " rojo " , " 00f067aa0ba902b7 " ) , ( " congo " , " t61rcWkgMzE " ) ] )
3043
@@ -53,31 +66,31 @@ final class TraceStateTests: XCTestCase {
5366
5467 // MARK: - Decoding
5568
56- func testInitValidRawValue ( ) {
69+ func testInitRawValueValidRawValue ( ) {
5770 let traceState = TraceState ( rawValue: " rojo=00f067aa0ba902b7,congo=t61rcWkgMzE " )
5871
5972 XCTAssertEqual ( traceState, TraceState ( [ ( " rojo " , " 00f067aa0ba902b7 " ) , ( " congo " , " t61rcWkgMzE " ) ] ) )
6073 }
6174
62- func testInitWithMultitenantRawValue ( ) {
75+ func testInitRawValueWithMultitenantRawValue ( ) {
6376 let traceState = TraceState ( rawValue: " fw529a3039@dt=00f067aa0ba902b7 " )
6477
6578 XCTAssertEqual ( traceState, TraceState ( [ ( " fw529a3039@dt " , " 00f067aa0ba902b7 " ) ] ) )
6679 }
6780
68- func testInitWithInvalidCharacterInKey ( ) {
81+ func testInitRawValueWithInvalidCharacterInKey ( ) {
6982 XCTAssertNil ( TraceState ( rawValue: " ROJO=00f067aa0ba902b7 " ) )
7083 }
7184
72- func testInitEmptyRawValue ( ) {
85+ func testInitRawValueEmptyRawValue ( ) {
7386 XCTAssertEqual ( TraceState ( rawValue: " " ) , TraceState ( [ ] ) )
7487 }
7588
76- func testInitWithTooLongKey ( ) {
89+ func testInitRawValueWithTooLongKey ( ) {
7790 XCTAssertNil ( TraceState ( rawValue: String ( repeating: " 1 " , count: 257 ) + " =t61rcWkgMzE " ) )
7891 }
7992
80- func testInitWithKeyEndingWithAtSign ( ) {
93+ func testInitRawValueWithKeyEndingWithAtSign ( ) {
8194 XCTAssertNil ( TraceState ( rawValue: " rojo@=00f067aa0ba902b7 " ) )
8295 }
8396
@@ -103,7 +116,7 @@ final class TraceStateTests: XCTestCase {
103116 ] ) )
104117 }
105118
106- func testInitWhitespaceOnly ( ) {
119+ func testInitRawValueWhitespaceOnly ( ) {
107120 XCTAssertEqual ( TraceState ( rawValue: " \t \t \t " ) , TraceState ( [ ] ) )
108121 }
109122}
0 commit comments