diff data/fileio/test/CSVFormatTest.h @ 1585:9570ef94eaa3

Add mechanism to retrieve the set of plausible separators found in CSV-like file when guessing its format
author Chris Cannam
date Wed, 09 Jan 2019 14:39:50 +0000
parents a92e94215863
children 1b8c4ee06f6d
line wrap: on
line diff
--- a/data/fileio/test/CSVFormatTest.h	Wed Nov 14 15:46:35 2018 +0000
+++ b/data/fileio/test/CSVFormatTest.h	Wed Jan 09 14:39:50 2019 +0000
@@ -91,6 +91,18 @@
         QCOMPARE(f.getColumnCount(), 3);
     }
     
+    void plausibleSeparators() {
+        CSVFormat f;
+        QVERIFY(f.guessFormatFor(csvDir.filePath("separator-many.csv")));
+        std::set<QChar> p;
+        p.insert(QChar('|'));
+        p.insert(QChar(','));
+        p.insert(QChar(':'));
+        p.insert(QChar(' '));
+        std::set<QChar> actual = f.getPlausibleSeparators();
+        QCOMPARE(actual, p);
+    }
+    
     void comment() {
         CSVFormat f;
         QVERIFY(f.guessFormatFor(csvDir.filePath("comment.csv")));