TestCsvParser.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2015 Enrico Mariotti <enricomariotti@yahoo.it>
  3. * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 2 or (at your option)
  8. * version 3 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef KEEPASSX_TESTCSVPARSER_H
  19. #define KEEPASSX_TESTCSVPARSER_H
  20. #include <QFile>
  21. #include <QObject>
  22. #include <QScopedPointer>
  23. #include <QTemporaryFile>
  24. #include "core/CsvParser.h"
  25. class CsvParser;
  26. class TestCsvParser : public QObject
  27. {
  28. Q_OBJECT
  29. public:
  30. private slots:
  31. void init();
  32. void cleanup();
  33. void initTestCase();
  34. void testUnicode();
  35. void testLF();
  36. void testEmptyReparsing();
  37. void testSimple();
  38. void testEmptyQuoted();
  39. void testEmptyNewline();
  40. void testSeparator();
  41. void testCR();
  42. void testCRLF();
  43. void testMalformed();
  44. void testQualifier();
  45. void testNewline();
  46. void testEmptySimple();
  47. void testMissingQuote();
  48. void testComments();
  49. void testBackslashSyntax();
  50. void testReparsing();
  51. void testEmptyFile();
  52. void testQuoted();
  53. void testMultiline();
  54. void testColumns();
  55. private:
  56. QScopedPointer<QTemporaryFile> file;
  57. QScopedPointer<CsvParser> parser;
  58. CsvTable t;
  59. void dumpRow(CsvTable table, int row);
  60. };
  61. #endif // KEEPASSX_TESTCSVPARSER_H