|
1 | | -// Copyright (c) 2018 Timofey Solomko |
2 | | -// Licensed under MIT License |
3 | | -// |
4 | | -// See LICENSE for license information |
5 | | - |
6 | 1 | import XCTest |
7 | | -@testable import BitByteDataTests |
8 | | -@testable import BitByteDataBenchmarks |
9 | | - |
10 | | -extension ByteReaderTests { |
11 | | - static var allTests: [(String, (ByteReaderTests) -> () -> Void)] { |
12 | | - return [ |
13 | | - ("testByte", testByte), |
14 | | - ("testIsFinished", testIsFinished), |
15 | | - ("testBytesLeft", testBytesLeft), |
16 | | - ("testBytesRead", testBytesRead), |
17 | | - ("testBytes", testBytes), |
18 | | - ("testIntFromBytes", testIntFromBytes), |
19 | | - ("testUint64", testUint64), |
20 | | - ("testUint64FromBytes", testUint64FromBytes), |
21 | | - ("testUint32", testUint32), |
22 | | - ("testUint32FromBytes", testUint32FromBytes), |
23 | | - ("testUint16", testUint16), |
24 | | - ("testUint16FromBytes", testUint16FromBytes), |
25 | | - ("testNonZeroStartIndex", testNonZeroStartIndex) |
26 | | - ] |
27 | | - } |
28 | | -} |
29 | | - |
30 | | -extension LsbBitReaderTests { |
31 | | - static var allTests: [(String, (LsbBitReaderTests) -> () -> Void)] { |
32 | | - return [ |
33 | | - ("testAdvance", testAdvance), |
34 | | - ("testBit", testBit), |
35 | | - ("testBits", testBits), |
36 | | - ("testIntFromBits", testIntFromBits), |
37 | | - ("testByteFromBits", testByteFromBits), |
38 | | - ("testUint16FromBits", testUint16FromBits), |
39 | | - ("testUint32FromBits", testUint32FromBits), |
40 | | - ("testUint64FromBits", testUint64FromBits), |
41 | | - ("testIsAligned", testIsAligned), |
42 | | - ("testAlign", testAlign), |
43 | | - ("testBytesLeft", testBytesLeft), |
44 | | - ("testBytesRead", testBytesRead), |
45 | | - ("testBitReaderByte", testBitReaderByte), |
46 | | - ("testBitReaderBytes", testBitReaderBytes), |
47 | | - ("testBitReaderIntFromBytes", testBitReaderIntFromBytes), |
48 | | - ("testBitReaderUint16", testBitReaderUint16), |
49 | | - ("testBitReaderUint32FromBytes", testBitReaderUint32FromBytes), |
50 | | - ("testBitReaderNonZeroStartIndex", testBitReaderNonZeroStartIndex), |
51 | | - ("testConvertedByteReader", testConvertedByteReader), |
52 | | - ("testBitsLeft", testBitsLeft), |
53 | | - ("testBitsLeft", testBitsRead) |
54 | | - ] |
55 | | - } |
56 | | -} |
57 | | - |
58 | | -extension MsbBitReaderTests { |
59 | | - static var allTests: [(String, (MsbBitReaderTests) -> () -> Void)] { |
60 | | - return [ |
61 | | - ("testAdvance", testAdvance), |
62 | | - ("testBit", testBit), |
63 | | - ("testBits", testBits), |
64 | | - ("testIntFromBits", testIntFromBits), |
65 | | - ("testByteFromBits", testByteFromBits), |
66 | | - ("testUint16FromBits", testUint16FromBits), |
67 | | - ("testUint32FromBits", testUint32FromBits), |
68 | | - ("testUint64FromBits", testUint64FromBits), |
69 | | - ("testIsAligned", testIsAligned), |
70 | | - ("testAlign", testAlign), |
71 | | - ("testBytesLeft", testBytesLeft), |
72 | | - ("testBytesRead", testBytesRead), |
73 | | - ("testBitReaderByte", testBitReaderByte), |
74 | | - ("testBitReaderBytes", testBitReaderBytes), |
75 | | - ("testBitReaderIntFromBytes", testBitReaderIntFromBytes), |
76 | | - ("testBitReaderUint16", testBitReaderUint16), |
77 | | - ("testBitReaderUint32FromBytes", testBitReaderUint32FromBytes), |
78 | | - ("testBitReaderNonZeroStartIndex", testBitReaderNonZeroStartIndex), |
79 | | - ("testConvertedByteReader", testConvertedByteReader), |
80 | | - ("testBitsLeft", testBitsLeft), |
81 | | - ("testBitsLeft", testBitsRead) |
82 | | - ] |
83 | | - } |
84 | | -} |
85 | | - |
86 | | -extension LsbBitWriterTests { |
87 | | - static var allTests: [(String, (LsbBitWriterTests) -> () -> Void)] { |
88 | | - return [ |
89 | | - ("testWriteBit", testWriteBit), |
90 | | - ("testWriteBitsArray", testWriteBitsArray), |
91 | | - ("testWriteNumber", testWriteNumber), |
92 | | - ("testWriteUnsignedNumber", testWriteUnsignedNumber), |
93 | | - ("testAppendByte", testAppendByte), |
94 | | - ("testAlign", testAlign), |
95 | | - ("testIsAligned", testIsAligned), |
96 | | - ("testNamingConsistency", testNamingConsistency) |
97 | | - ] |
98 | | - } |
99 | | -} |
100 | | - |
101 | | -extension MsbBitWriterTests { |
102 | | - static var allTests: [(String, (MsbBitWriterTests) -> () -> Void)] { |
103 | | - return [ |
104 | | - ("testWriteBit", testWriteBit), |
105 | | - ("testWriteBitsArray", testWriteBitsArray), |
106 | | - ("testWriteNumber", testWriteNumber), |
107 | | - ("testWriteUnsignedNumber", testWriteUnsignedNumber), |
108 | | - ("testAppendByte", testAppendByte), |
109 | | - ("testAlign", testAlign), |
110 | | - ("testIsAligned", testIsAligned), |
111 | | - ("testNamingConsistency", testNamingConsistency) |
112 | | - ] |
113 | | - } |
114 | | -} |
115 | | - |
116 | | -extension ByteReaderBenchmarks { |
117 | | - static var allTests: [(String, (ByteReaderBenchmarks) -> () -> Void)] { |
118 | | - return [ |
119 | | - ("testByte", testByte), |
120 | | - ("testBytes", testBytes), |
121 | | - ("testIntFromBytes", testIntFromBytes), |
122 | | - ("testUint16", testUint16), |
123 | | - ("testUint16FromBytes", testUint16FromBytes), |
124 | | - ("testUint32", testUint32), |
125 | | - ("testUint32FromBytes", testUint32FromBytes), |
126 | | - ("testUint64", testUint64), |
127 | | - ("testUint64FromBytes", testUint64FromBytes) |
128 | | - ] |
129 | | - } |
130 | | -} |
131 | | - |
132 | | -extension LsbBitReaderBenchmarks { |
133 | | - static var allTests: [(String, (LsbBitReaderBenchmarks) -> () -> Void)] { |
134 | | - return [ |
135 | | - ("testAdvance", testAdvance), |
136 | | - ("testBit", testBit), |
137 | | - ("testBits", testBits), |
138 | | - ("testIntFromBits", testIntFromBits), |
139 | | - ("testByteFromBits", testByteFromBits), |
140 | | - ("testUint16FromBits", testUint16FromBits), |
141 | | - ("testUint32FromBits", testUint32FromBits), |
142 | | - ("testUint64FromBits", testUint64FromBits) |
143 | | - ] |
144 | | - } |
145 | | -} |
146 | | - |
147 | | -extension MsbBitReaderBenchmarks { |
148 | | - static var allTests: [(String, (MsbBitReaderBenchmarks) -> () -> Void)] { |
149 | | - return [ |
150 | | - ("testAdvance", testAdvance), |
151 | | - ("testBit", testBit), |
152 | | - ("testBits", testBits), |
153 | | - ("testIntFromBits", testIntFromBits), |
154 | | - ("testByteFromBits", testByteFromBits), |
155 | | - ("testUint16FromBits", testUint16FromBits), |
156 | | - ("testUint32FromBits", testUint32FromBits), |
157 | | - ("testUint64FromBits", testUint64FromBits) |
158 | | - ] |
159 | | - } |
160 | | -} |
161 | | - |
162 | | -extension LsbBitWriterBenchmarks { |
163 | | - static var allTests: [(String, (LsbBitWriterBenchmarks) -> () -> Void)] { |
164 | | - return [ |
165 | | - ("testWriteBit", testWriteBit), |
166 | | - ("testWriteNumberBitsCount", testWriteNumberBitsCount), |
167 | | - ("testWriteUnsignedNumberBitsCount", testWriteUnsignedNumberBitsCount), |
168 | | - ("testAppendByte", testAppendByte) |
169 | | - ] |
170 | | - } |
171 | | -} |
172 | 2 |
|
173 | | -extension MsbBitWriterBenchmarks { |
174 | | - static var allTests: [(String, (MsbBitWriterBenchmarks) -> () -> Void)] { |
175 | | - return [ |
176 | | - ("testWriteBit", testWriteBit), |
177 | | - ("testWriteNumberBitsCount", testWriteNumberBitsCount), |
178 | | - ("testWriteUnsignedNumberBitsCount", testWriteUnsignedNumberBitsCount), |
179 | | - ("testAppendByte", testAppendByte) |
180 | | - ] |
181 | | - } |
182 | | -} |
| 3 | +import BitByteDataBenchmarks |
| 4 | +import BitByteDataTests |
183 | 5 |
|
184 | | -XCTMain([ |
185 | | - testCase(ByteReaderTests.allTests), |
186 | | - testCase(LsbBitReaderTests.allTests), |
187 | | - testCase(MsbBitReaderTests.allTests), |
188 | | - testCase(LsbBitWriterTests.allTests), |
189 | | - testCase(MsbBitWriterTests.allTests), |
| 6 | +var tests = [XCTestCaseEntry]() |
| 7 | +tests += BitByteDataBenchmarks.__allTests() |
| 8 | +tests += BitByteDataTests.__allTests() |
190 | 9 |
|
191 | | - testCase(ByteReaderBenchmarks.allTests), |
192 | | - testCase(LsbBitReaderBenchmarks.allTests), |
193 | | - testCase(MsbBitReaderBenchmarks.allTests), |
194 | | - testCase(LsbBitWriterBenchmarks.allTests), |
195 | | - testCase(MsbBitWriterBenchmarks.allTests) |
196 | | -]) |
| 10 | +XCTMain(tests) |
0 commit comments