Commit graph

56 commits

Author SHA1 Message Date
Dirk Hohndel
afe7e847d6 Whitespace cleanup tests
Again, entirely script based.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26 16:32:51 +03:00
Dirk Hohndel
d577467f97 Core: introduce new subsurface-string header
First small step to shrinking dive.h.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14 10:13:39 -07:00
Miika Turkia
4186733740 CSV import: fix setpoint (typo)
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-04-19 15:09:02 +03:00
Stefan Fuchs
5c9345976c CSV import/export: Sort parameter list and add comment
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-19 11:59:58 -07:00
Miika Turkia
f2beeb4078 Parameter size needs to be increased for test
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
4a5b40c144 Update DL7 tests to current import
As we now parse dives without profile, we get 2 more dives from the
sample log import (3 in total). And naturally also the resulting XML to
compare against needs to be updated.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
e2197a56a4 Compare DL7 import to saved conversion
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
fbbca93d53 Add test for DL7 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08 06:06:12 +02:00
Miika Turkia
02c80a60b0 Refactore parse-xml.c into parse.c and parse-xml.c
This should help us to move parsing that is not XML related to other
files, hopefully making the code cleaner.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27 13:42:10 -08:00
Miika Turkia
e17ad1b0e0 Add test for DM5 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27 13:42:10 -08:00
Dirk Hohndel
c6bc88b50d Fix some warnings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 07:21:37 -07:00
Miika Turkia
726c9e859c Test case for CSV profile export to imperial and back
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-12 14:05:33 -07:00
Dirk Hohndel
d7cf3408e5 Merge branch 'seabear-refactor'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-07 07:52:55 -07:00
Miika Turkia
0829d601c6 Change test case to use new Seabear parsing function
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 16:32:11 +03:00
Miika Turkia
ab1813a445 Move intdup to qthelper
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07 09:41:27 +03:00
Miika Turkia
b7c6998cf7 Enable test mode in UDDF export test
Using the units parameter to indicate test mode on UDDF export.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Miika Turkia
e52d9c2846 Add UDDF export-import test
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Miika Turkia
52426b8585 Fix memory leak
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06 08:06:42 -07:00
Dirk Hohndel
ee1bf18189 Add SPDX header to tests
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Miika Turkia
2b2df88e87 Cleanup for CSV testing
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01 08:06:09 -07:00
Miika Turkia
8bb9eb501b Enable CSV import-export unit conversion test
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01 08:06:09 -07:00
Miika Turkia
acd791b7c1 Export-import test for manual CSV
Note that the actual validation of the result is currently disabled, so
the tests will pass even though there are some bugs and rounding errors
present.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01 08:06:09 -07:00
Miika Turkia
a0ed0ff823 Change parseCSV to support unit and file selection
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01 08:06:09 -07:00
Jeremie Guichard
b9a3dfb86b Rework TestParse to make tests independent from each other
In the original version, parsing and comparing output was
done in separate test methods. This was forbidding use of
QTest cleanup to call clear_dive_file_data().
As a side effect a failure in one test would make other tests
failing too (since call to clear_dive_file_data was skipped
by QCOMPARE failure).

Added a FILE_COMPARE macro to avoid code duplication.

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-04 12:03:33 -08:00
Jeremie Guichard
7329629b6e Use proper order in QCOMPARE arguments
Expected value is the second argument of QCOMPARE,
having the arguments in the right order avoid confusion
when looking at error message in case of test failure.

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-04 12:03:33 -08:00
Jeremie Guichard
f28aab7bd9 Fix trailing '\r' test failure on Windows
Windows implementation of fwrite changes \n to \r\n
for files opened in text mode.
It caused failures in TestMerge and TestParse when
comparing written files against reference data.

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-02-25 09:24:23 -08:00
Jeremie Guichard
1e2580c3fd Use SUBSURFACE_TEST_DATA definition to point to test data dir
Update tests with a (compile time) option SUBSURFACE_TEST_DATA,
pointing to test data base path. It is needed for cross compilation cases.
SUBSURFACE_TEST_DATA is set to SUBSURFACE_SOURCE by default,
or configurable via cmake option -DSUBSURFACE_TEST_DATA="...".

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-02-24 01:10:22 -08:00
Dirk Hohndel
ec20d36f3c Add test for merging multiple cylinders
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09 22:22:12 -08:00
Dirk Hohndel
8f97c4a8eb Reenable all of TestParse
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09 16:54:48 -08:00
Miika Turkia
0630d584f4 Fix dive number comparison for Seabear import tests 2017-02-09 09:41:56 -08:00
Miika Turkia
d3cc3f371b Add numberField parameter for parse testing 2017-02-09 09:22:30 -08:00
Miika Turkia
19a2c28b1a Fix typo on parse testing 2017-02-09 09:22:30 -08:00
Dirk Hohndel
97baf9b54b TestParse: disable failing tests
I don't understand why the SeaBear tests fail... of course commenting
out failing tests is exactly the wrong thing to do. But I'll open an
issue on github instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 22:08:56 -08:00
Dirk Hohndel
77ed1b682e TestParse: prevent crashes
Two CSV imports are failing right now; we shouldn't access uninitialized
memory when that happens.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-06 04:49:24 -08:00
Dirk Hohndel
90af2f1f48 TestParse: make sure we get one dive from SeabearHUDC
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05 16:11:20 -08:00
Anton Lundin
c2ea3c2616 Our tests are actually GUILESS
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05 14:45:25 -08:00
Tomaz Canabrava
3776c285e2 Test line-by-line for equality on Test
We where testing the whole document, wich made qDebug
completely bogus to see where we failed at testing the
generated file. If we test line-by-line, we can know
more easily where we failed.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-27 08:27:21 -08:00
Tomaz Canabrava
27b4ef321a Correctly open the resource file
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-27 08:27:21 -08:00
Tomaz Canabrava
21e8b1e363 Fix compilation with the new folder architecture
A few more fixes for things that broke in commit 7be962bfc2 ("Move
subsurface-core to core and qt-mobile to mobile-widgets").

[Dirk Hohndel: slightly edited and overlap with Linus' patch removed]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 12:32:36 -07:00
Dirk Hohndel
c2e1619cd1 Silence warnings in testparse.cpp
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 21:50:37 -08:00
Tomaz Canabrava
04e39704e2 Fix annoyances on file.c
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07 11:24:10 -08:00
Dirk Hohndel
edac07554c Make sure we don't create multiple dive sites with the same uuid
This shouldn't happen, but in case there is a logic error higher up in the
code somewhere, this will prevent it from happening, period.

If the code asks for a new dive site with a specific uuid, simply return
the existing dive site with that uuid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-29 12:58:16 -04:00
Miika Turkia
1e8ea9061e Test case: compare DLD log with a saved one
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-13 15:28:04 -07:00
Miika Turkia
0160e58e7d Test case: reading zip and DLD parsing
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-13 15:27:54 -07:00
Miika Turkia
14999341e0 Update tests to use cleaner CSV parsing "API"
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27 08:59:50 -07:00
Miika Turkia
6721698fcd Change Seabear TestParse to use reduced parameters
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:59:45 -07:00
Miika Turkia
ad75b09581 Change TestParse to use reduced parameters
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:59:29 -07:00
Miika Turkia
921041163b Seabear import: fix detection of empty lines
The old code trusted in Windows new lines with length of 3. The new code
strips out spaces and line ending chars resulting in empty line being
of length 0.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-28 09:32:53 -07:00
Miika Turkia
96b612941e Test case: Seabear new format
This validates Seabear import from H3 and T1 dive computers that use new
CSV format to store the logs. The fields wary depending on the dive
mode, thus we need to parse the field configuration during import.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-28 08:47:05 -07:00
Miika Turkia
80fe9f8c0d Test case: HUDC import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-27 06:35:19 -07:00