Commit graph

83 commits

Author SHA1 Message Date
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
Miika Turkia
5d4f81206d Test DM4 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-26 09:14:12 -07:00
Miika Turkia
c19f4869af Create test case for DivingLog SQLite import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-24 13:21:19 -07:00
Dirk Hohndel
ccc9d80015 Remove all the no longer necessary code that aborts read of first V2 file
This was a poorly implemented hack when we executed the reverse geo lookup
in the main thread and opening a V2 file could take a very long time. We
need to do the "Welcome" message quite differently.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:41:56 -07:00
Dirk Hohndel
79bb61dba1 Adapt CSV test to include suit
Also fixed it to correctly parse the mean depth (duh, a test that had a
bug) and added a buddy field for good measure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-24 07:07:31 -07:00
Miika Turkia
c80d1879b7 Add suit field for CSV import
Fixes #853

[Dirk Hohndel: fixed test compile]

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-24 06:50:50 -07:00
Dirk Hohndel
b47d8d5992 Some simple test for file parsing
With no V2 question shown
- parsing fails when a V2 file is loaded
- parsing succeeds when a V3 file is loaded
- import of CSV file succeeds

With V2 question shown
- parsing succeeds when a V2 file is loaded

Finally compare the output of reading in the various files with reference
output included in the sources.

My guess is that this test might be a bit fragile, but hey, it's a start.

(reminder: the tests only get built when using cmake)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-14 18:15:08 -07:00