Mercurial > hg > svcore
comparison data/fileio/test/CSVFormatTest.h @ 1525:a92e94215863
Various CSV format tests
author | Chris Cannam |
---|---|
date | Fri, 14 Sep 2018 14:47:46 +0100 |
parents | 64ef24ebb19c |
children | 9570ef94eaa3 |
comparison
equal
deleted
inserted
replaced
1524:64ef24ebb19c | 1525:a92e94215863 |
---|---|
123 CSVFormat::ColumnIntegral | | 123 CSVFormat::ColumnIntegral | |
124 CSVFormat::ColumnIncreasing | | 124 CSVFormat::ColumnIncreasing | |
125 CSVFormat::ColumnNearEmpty); | 125 CSVFormat::ColumnNearEmpty); |
126 QCOMPARE(q, expected); | 126 QCOMPARE(q, expected); |
127 } | 127 } |
128 | |
129 void modelType1DSamples() { | |
130 CSVFormat f; | |
131 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-1d-samples.csv"))); | |
132 QCOMPARE(f.getColumnCount(), 1); | |
133 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnStartTime); | |
134 QCOMPARE(f.getTimingType(), CSVFormat::ExplicitTiming); | |
135 QCOMPARE(f.getTimeUnits(), CSVFormat::TimeAudioFrames); | |
136 QCOMPARE(f.getModelType(), CSVFormat::OneDimensionalModel); | |
137 } | |
138 | |
139 void modelType1DSeconds() { | |
140 CSVFormat f; | |
141 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-1d-seconds.csv"))); | |
142 QCOMPARE(f.getColumnCount(), 2); | |
143 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnStartTime); | |
144 QCOMPARE(f.getColumnPurpose(1), CSVFormat::ColumnLabel); | |
145 QCOMPARE(f.getTimingType(), CSVFormat::ExplicitTiming); | |
146 QCOMPARE(f.getTimeUnits(), CSVFormat::TimeSeconds); | |
147 QCOMPARE(f.getModelType(), CSVFormat::OneDimensionalModel); | |
148 } | |
149 | |
150 void modelType2DSamples() { | |
151 CSVFormat f; | |
152 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-2d-samples.csv"))); | |
153 QCOMPARE(f.getColumnCount(), 2); | |
154 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnStartTime); | |
155 QCOMPARE(f.getColumnPurpose(1), CSVFormat::ColumnValue); | |
156 QCOMPARE(f.getTimingType(), CSVFormat::ExplicitTiming); | |
157 QCOMPARE(f.getTimeUnits(), CSVFormat::TimeAudioFrames); | |
158 QCOMPARE(f.getModelType(), CSVFormat::TwoDimensionalModel); | |
159 } | |
160 | |
161 void modelType2DSeconds() { | |
162 CSVFormat f; | |
163 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-2d-seconds.csv"))); | |
164 QCOMPARE(f.getColumnCount(), 2); | |
165 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnStartTime); | |
166 QCOMPARE(f.getColumnPurpose(1), CSVFormat::ColumnValue); | |
167 QCOMPARE(f.getTimingType(), CSVFormat::ExplicitTiming); | |
168 QCOMPARE(f.getTimeUnits(), CSVFormat::TimeSeconds); | |
169 QCOMPARE(f.getModelType(), CSVFormat::TwoDimensionalModel); | |
170 } | |
171 | |
172 void modelType2DImplicit() { | |
173 CSVFormat f; | |
174 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-2d-implicit.csv"))); | |
175 QCOMPARE(f.getColumnCount(), 1); | |
176 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnValue); | |
177 QCOMPARE(f.getTimingType(), CSVFormat::ImplicitTiming); | |
178 } | |
179 | |
180 void modelType2DEndTimeSamples() { | |
181 CSVFormat f; | |
182 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-2d-endtime-samples.csv"))); | |
183 QCOMPARE(f.getColumnCount(), 3); | |
184 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnStartTime); | |
185 QCOMPARE(f.getColumnPurpose(1), CSVFormat::ColumnEndTime); | |
186 QCOMPARE(f.getColumnPurpose(2), CSVFormat::ColumnValue); | |
187 QCOMPARE(f.getTimingType(), CSVFormat::ExplicitTiming); | |
188 QCOMPARE(f.getTimeUnits(), CSVFormat::TimeAudioFrames); | |
189 QCOMPARE(f.getModelType(), CSVFormat::TwoDimensionalModelWithDuration); | |
190 } | |
191 | |
192 void modelType2DEndTimeSeconds() { | |
193 CSVFormat f; | |
194 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-2d-endtime-seconds.csv"))); | |
195 QCOMPARE(f.getColumnCount(), 3); | |
196 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnStartTime); | |
197 QCOMPARE(f.getColumnPurpose(1), CSVFormat::ColumnEndTime); | |
198 QCOMPARE(f.getColumnPurpose(2), CSVFormat::ColumnValue); | |
199 QCOMPARE(f.getTimingType(), CSVFormat::ExplicitTiming); | |
200 QCOMPARE(f.getTimeUnits(), CSVFormat::TimeSeconds); | |
201 QCOMPARE(f.getModelType(), CSVFormat::TwoDimensionalModelWithDuration); | |
202 } | |
203 | |
204 void modelType2DDurationSamples() { | |
205 CSVFormat f; | |
206 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-2d-duration-samples.csv"))); | |
207 QCOMPARE(f.getColumnCount(), 3); | |
208 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnStartTime); | |
209 QCOMPARE(f.getColumnPurpose(1), CSVFormat::ColumnDuration); | |
210 QCOMPARE(f.getColumnPurpose(2), CSVFormat::ColumnValue); | |
211 QCOMPARE(f.getTimingType(), CSVFormat::ExplicitTiming); | |
212 QCOMPARE(f.getTimeUnits(), CSVFormat::TimeAudioFrames); | |
213 QCOMPARE(f.getModelType(), CSVFormat::TwoDimensionalModelWithDuration); | |
214 } | |
215 | |
216 void modelType2DDurationSeconds() { | |
217 CSVFormat f; | |
218 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-2d-duration-seconds.csv"))); | |
219 QCOMPARE(f.getColumnCount(), 3); | |
220 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnStartTime); | |
221 QCOMPARE(f.getColumnPurpose(1), CSVFormat::ColumnDuration); | |
222 QCOMPARE(f.getColumnPurpose(2), CSVFormat::ColumnValue); | |
223 QCOMPARE(f.getTimingType(), CSVFormat::ExplicitTiming); | |
224 QCOMPARE(f.getTimeUnits(), CSVFormat::TimeSeconds); | |
225 QCOMPARE(f.getModelType(), CSVFormat::TwoDimensionalModelWithDuration); | |
226 } | |
227 | |
228 void modelType3DSamples() { | |
229 CSVFormat f; | |
230 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-3d-samples.csv"))); | |
231 QCOMPARE(f.getColumnCount(), 7); | |
232 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnStartTime); | |
233 QCOMPARE(f.getColumnPurpose(1), CSVFormat::ColumnValue); | |
234 QCOMPARE(f.getColumnPurpose(2), CSVFormat::ColumnValue); | |
235 QCOMPARE(f.getColumnPurpose(3), CSVFormat::ColumnValue); | |
236 QCOMPARE(f.getColumnPurpose(4), CSVFormat::ColumnValue); | |
237 QCOMPARE(f.getColumnPurpose(5), CSVFormat::ColumnValue); | |
238 QCOMPARE(f.getColumnPurpose(6), CSVFormat::ColumnValue); | |
239 QCOMPARE(f.getTimingType(), CSVFormat::ExplicitTiming); | |
240 QCOMPARE(f.getTimeUnits(), CSVFormat::TimeAudioFrames); | |
241 QCOMPARE(f.getModelType(), CSVFormat::ThreeDimensionalModel); | |
242 } | |
243 | |
244 void modelType3DSeconds() { | |
245 CSVFormat f; | |
246 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-3d-seconds.csv"))); | |
247 QCOMPARE(f.getColumnCount(), 7); | |
248 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnStartTime); | |
249 QCOMPARE(f.getColumnPurpose(1), CSVFormat::ColumnValue); | |
250 QCOMPARE(f.getColumnPurpose(2), CSVFormat::ColumnValue); | |
251 QCOMPARE(f.getColumnPurpose(3), CSVFormat::ColumnValue); | |
252 QCOMPARE(f.getColumnPurpose(4), CSVFormat::ColumnValue); | |
253 QCOMPARE(f.getColumnPurpose(5), CSVFormat::ColumnValue); | |
254 QCOMPARE(f.getColumnPurpose(6), CSVFormat::ColumnValue); | |
255 QCOMPARE(f.getTimingType(), CSVFormat::ExplicitTiming); | |
256 QCOMPARE(f.getTimeUnits(), CSVFormat::TimeSeconds); | |
257 QCOMPARE(f.getModelType(), CSVFormat::ThreeDimensionalModel); | |
258 } | |
259 | |
260 void modelType3DImplicit() { | |
261 CSVFormat f; | |
262 QVERIFY(f.guessFormatFor(csvDir.filePath("model-type-3d-implicit.csv"))); | |
263 QCOMPARE(f.getColumnCount(), 6); | |
264 QCOMPARE(f.getColumnPurpose(0), CSVFormat::ColumnValue); | |
265 QCOMPARE(f.getColumnPurpose(1), CSVFormat::ColumnValue); | |
266 QCOMPARE(f.getColumnPurpose(2), CSVFormat::ColumnValue); | |
267 QCOMPARE(f.getColumnPurpose(3), CSVFormat::ColumnValue); | |
268 QCOMPARE(f.getColumnPurpose(4), CSVFormat::ColumnValue); | |
269 QCOMPARE(f.getColumnPurpose(5), CSVFormat::ColumnValue); | |
270 QCOMPARE(f.getTimingType(), CSVFormat::ImplicitTiming); | |
271 QCOMPARE(f.getModelType(), CSVFormat::ThreeDimensionalModel); | |
272 } | |
273 | |
128 }; | 274 }; |
129 | 275 |
130 #endif | 276 #endif |