Mercurial > hg > svcore
diff data/fileio/test/CSVReaderTest.h @ 1872:566476eeeb80 csv-import-headers
Support headers in actual import step, + test
author | Chris Cannam |
---|---|
date | Thu, 18 Jun 2020 11:55:28 +0100 |
parents | 2654bf447a84 |
children | 1d44fdc8196c |
line wrap: on
line diff
--- a/data/fileio/test/CSVReaderTest.h Thu Jun 18 11:55:17 2020 +0100 +++ b/data/fileio/test/CSVReaderTest.h Thu Jun 18 11:55:28 2020 +0100 @@ -81,6 +81,16 @@ delete model; } + void modelType1DSamplesWithHeader() { + Model *model = nullptr; + loadFrom("model-type-1d-samples-header.csv", model); + auto actual = qobject_cast<SparseOneDimensionalModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getAllEvents().size(), 5); + //!!! + the actual contents + delete model; + } + void modelType1DSeconds() { Model *model = nullptr; loadFrom("model-type-1d-seconds.csv", model); @@ -90,6 +100,15 @@ delete model; } + void modelType1DSecondsWithHeader() { + Model *model = nullptr; + loadFrom("model-type-1d-seconds-header.csv", model); + auto actual = qobject_cast<SparseOneDimensionalModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getAllEvents().size(), 5); + delete model; + } + void modelType2DDurationSamples() { Model *model = nullptr; loadFrom("model-type-2d-duration-samples.csv", model); @@ -98,6 +117,15 @@ QCOMPARE(actual->getAllEvents().size(), 5); delete model; } + + void modelType2DDurationSamplesWithHeader() { + Model *model = nullptr; + loadFrom("model-type-2d-duration-samples-header.csv", model); + auto actual = qobject_cast<RegionModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getAllEvents().size(), 5); + delete model; + } void modelType2DDurationSeconds() { Model *model = nullptr; @@ -108,6 +136,15 @@ delete model; } + void modelType2DDurationSecondsWithHeader() { + Model *model = nullptr; + loadFrom("model-type-2d-duration-seconds-header.csv", model); + auto actual = qobject_cast<RegionModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getAllEvents().size(), 5); + delete model; + } + void badNegativeDuration() { Model *model = nullptr; loadFrom("bad-negative-duration.csv", model); @@ -127,6 +164,15 @@ delete model; } + void modelType2DEndTimeSamplesWithHeader() { + Model *model = nullptr; + loadFrom("model-type-2d-endtime-samples-header.csv", model); + auto actual = qobject_cast<RegionModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getAllEvents().size(), 5); + delete model; + } + void modelType2DEndTimeSeconds() { Model *model = nullptr; loadFrom("model-type-2d-endtime-seconds.csv", model); @@ -136,6 +182,15 @@ delete model; } + void modelType2DEndTimeSecondsWithHeader() { + Model *model = nullptr; + loadFrom("model-type-2d-endtime-seconds-header.csv", model); + auto actual = qobject_cast<RegionModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getAllEvents().size(), 5); + delete model; + } + void modelType2DImplicit() { Model *model = nullptr; loadFrom("model-type-2d-implicit.csv", model); @@ -145,6 +200,15 @@ delete model; } + void modelType2DImplicitWithHeader() { + Model *model = nullptr; + loadFrom("model-type-2d-implicit-header.csv", model); + auto actual = qobject_cast<SparseTimeValueModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getAllEvents().size(), 5); + delete model; + } + void modelType2DSamples() { Model *model = nullptr; loadFrom("model-type-2d-samples.csv", model); @@ -154,6 +218,15 @@ delete model; } + void modelType2DSamplesWithHeader() { + Model *model = nullptr; + loadFrom("model-type-2d-samples-header.csv", model); + auto actual = qobject_cast<SparseTimeValueModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getAllEvents().size(), 5); + delete model; + } + void modelType2DSeconds() { Model *model = nullptr; loadFrom("model-type-2d-seconds.csv", model); @@ -163,6 +236,15 @@ delete model; } + void modelType2DSecondsWithHeader() { + Model *model = nullptr; + loadFrom("model-type-2d-seconds-header.csv", model); + auto actual = qobject_cast<SparseTimeValueModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getAllEvents().size(), 5); + delete model; + } + void modelType3DImplicit() { Model *model = nullptr; loadFrom("model-type-3d-implicit.csv", model); @@ -173,6 +255,16 @@ delete model; } + void modelType3DImplicitWithHeader() { + Model *model = nullptr; + loadFrom("model-type-3d-implicit-header.csv", model); + auto actual = qobject_cast<EditableDenseThreeDimensionalModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getWidth(), 6); + QCOMPARE(actual->getHeight(), 6); + delete model; + } + void modelType3DSamples() { Model *model = nullptr; loadFrom("model-type-3d-samples.csv", model); @@ -183,6 +275,16 @@ delete model; } + void modelType3DSamplesWithHeader() { + Model *model = nullptr; + loadFrom("model-type-3d-samples-header.csv", model); + auto actual = qobject_cast<EditableDenseThreeDimensionalModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getWidth(), 6); + QCOMPARE(actual->getHeight(), 6); + delete model; + } + void modelType3DSeconds() { Model *model = nullptr; loadFrom("model-type-3d-seconds.csv", model); @@ -193,6 +295,16 @@ delete model; } + void modelType3DSecondsWithHeader() { + Model *model = nullptr; + loadFrom("model-type-3d-seconds-header.csv", model); + auto actual = qobject_cast<EditableDenseThreeDimensionalModel *>(model); + QVERIFY(actual); + QCOMPARE(actual->getWidth(), 6); + QCOMPARE(actual->getHeight(), 6); + delete model; + } + void withBlankLines1D() { Model *model = nullptr; loadFrom("with-blank-lines-1d.csv", model);