Commit graph

65 commits

Author SHA1 Message Date
Tomaz Canabrava
3dce5de12d Add the beginning of the Preferences test
And it actually helped me to find a bug. yey.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-28 20:01:23 -07:00
Tomaz Canabrava
3d788414c7 Add renumber test as a dependency for running the tests
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-28 20:00:25 -07:00
Rick Walsh
b827107619 Update TestPlan for divedatapoint storing cylinder id instead of gasmix
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:07:55 -07: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
Tomaz Canabrava
5f9df02ffc Fix tests linkage
I wasn't linking the tests against the qrc library, which made trying to
load the xslt transformation files for the parse test fail.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-24 16:32:38 -07:00
Dirk Hohndel
aef6364921 Prevent possible SIGSEGV in test
If the load fails the get_dive(1) could return NULL. Let's catch that as
an error instead of having the test crash.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-23 12:12:11 -07:00
Dirk Hohndel
4ceb65938a Silence warnings in testplan.cpp
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 21:50:37 -08: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
Robert C. Helling
c32f5cc278 Silence compiler warnings
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-01 18:01:05 -08:00
Dirk Hohndel
787b12cff4 Remove unnecessary call from tests
Now that the WindowTitleUpdater is fixed we don't need to create an
instance in the tests, either.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-07 09:56:41 -08:00
Tomaz Canabrava
c66de6f707 Do not depend on the subsurface_core qrc for tests
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-02 12:52:59 -08:00
Tomaz Canabrava
044e593957 CMake for tests in its own folder
Besides making it more simple to add a new test now since
you don't need to play hide and seek with the main cmake
this has another good thing: on IDE's that scan the cmake
to create targets on the project tree, the main project
was being popullated with test-targets on the main tree
and not inside the tests directory.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Dirk Hohndel
5d2436b504 Add test for more GPS coordinates
We really should be able to parse the coordinates that we show in our own
HTML export as well as the standard Google format... both have a comma
between the latitude and longitude.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-07 17:18:44 +01:00
Rick Walsh
cd0963c26f TestPlan: update known Subsurface runtimes
The purpose of testing against known Subsurface runtimes is to warn (when test
is run in verbose mode) if the runtime has altered. Before the next release, we
should update the known Subsurface runtimes to match current behaviour, so we
are alerted when we change something during the next release cycle.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 15:18:48 +01:00
Rick Walsh
117d13485c TestPlan: include subsurfacestartup.h
Commit 9d8b0ad introduces the copy_prefs function, and uses it to replace prefs
= default_prefs. We need to include subsurfacestartup.h for it to work in
testplan.cpp, otherwise TestPlan_build fails.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 15:16:49 +01:00
Dirk Hohndel
9d8b0addf9 Correctly copy preferences
When just assigning one structure to the other we copy the string
pointers. If we then modify those strings in the copy, we happily free
the strings of the original. And then resetting the preferences equally
happily reused those strings, pointing to long since freed memory.

I think what I did now is excessive for the current use case in that it
copies a ton of strings that are unset in the default_prefs. But I figured
this is a rarely used function and I might as well do it correctly.

Also, once we implement multi user support with per user preferences we
will be copying completely populated preferences around (at least that's
my guess).

Fixes #940

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06 10:19:43 +01:00
Dirk Hohndel
cb112f9ac5 Add test for import, merge and renumbering
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-05 16:35:09 +01: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
Rick Walsh
fe9958380e TestPlan: Set VPM-B conservatism to zero
The VPM-B benchmark results are all based on nominal/zero conservatism, so we
should make sure we use zero conservatism in the tests.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-27 12:53:46 -04:00
Rick Walsh
084b4152e4 TestPlan: Add test for repeating dive
If variables were accidentally carried through from a previous calculated plan,
subsequent plan could be affected.  This test aims to detect if this happens.
Commit 8994270 corrected such a bug.  If it were reverted, this test would fail
(as it should).

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-22 07:36:37 -07:00
Dirk Hohndel
ade2067155 Git storage test: need to instantiate the window title updater class
Otherwise calling the static function can cause a crash in
mark_divelist_changed()

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-18 12:05:07 -07: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
Robert C. Helling
40122e4233 Prevent tests from hanging when offline
From 31e324797c06d366f49db453a67a119819ca8012 Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <helling@atdotde.de>
Date: Wed, 2 Sep 2015 17:28:12 +0200
Subject: [PATCH] Test that there is a dive

so that the TestGitStorage does not hang when offline.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-02 09:11:20 -07:00
Robert C. Helling
10d8a625d0 Adopt expected times in TestPlan
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:19:10 -07:00
Robert C. Helling
3a7109e44e Changed qInfo() to qDebug()
... as the former was introduced only in Qt 5.5 in order to make the
test build also with 5.4

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-31 15:13:43 -07:00
Dirk Hohndel
6d7faa106f Add test case for multi line dive notes merging
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 13:00:32 -07:00
Dirk Hohndel
1b37e0f1a4 Add test for dive site duplication bug
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 10:32:38 -07:00
Rick Walsh
d15a1db428 TestPlan: Do not re-declare bool result
Fixing this error makes TestPlan pass again.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-30 09:14:58 -07:00
Rick Walsh
954c30c4cf VPM-B Tests: Compare against known Subsurface runtime
We should compare the calculated runtime against the runtime previously
calculated by Subsurface, expecting them to match exactly, in order to detect if
a change has been made.  We still compare against a benchmark, allowing some
difference.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:56 -07:00
Rick Walsh
1e7dd49234 Update expected runtime of VPM-B test to match benchmark
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:32 -07:00
Rick Walsh
961c218c06 VPM-B Tests: Output first ceiling
This is useful for determining why we calculate a difference profile

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-29 20:06:28 -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
Rick Walsh
6c43685eda Dive planner tests: pass dives that are close to expected duration
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 17:55:59 -07:00
Dirk Hohndel
c22adebebe Merge branch 'gitMerge' 2015-08-25 13:57:12 -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
Rick Walsh
e47f62f869 VPM-B: Add more planner tests
Add more VPM-B planner tests.  The "expected" total run time is taken as the
total run time produced by the Fortran VPM-B program.  For all these tests, the
results are within two minutes, which is a good result, but most are classified
as a "fail".

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:57:26 -07:00
Rick Walsh
e25404c9f2 Test VPM-B Correct expected dive time in comment
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:57:09 -07:00
Rick Walsh
3ea7ee1934 Test another VPM-B dive plan
This adds a test for 100 m for 60 min dive on trimix using VPM-B

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:57:06 -07:00
Dirk Hohndel
72817ff47f Cloud storage: second merge test, delete dive on one side, modify on other
Delete a dive while offline, modify it from a different system while
online. Then resync.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:44:30 -07:00
Dirk Hohndel
9f5a944107 Cloud storage: first test case for a very simple merge
- We add a dive while offline.
- On a different computer (here simulated by a different local cache) we
  add a different file.
- Now we go back to the previous local cache (the one where we added a
  different dive in the first step) and take that online (i.e., connect to
  cloud storage). Now both of the new dives should have been added to our
  data file.

This is a rather trivial test with no conflict and a straight forward
merge. We need to add a lot more test cases to make sure this works as
expected and doesn't leave the user with a corrupt state.

Ideally whatever happens, the user should never see an error...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:44:15 -07:00
Dirk Hohndel
449ba2876f Cloud storage: test offline operation
All this really does is make sure that the fast forward works if the local
cache has received updates that haven't made it to the server, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:44:10 -07:00
Dirk Hohndel
092abe9b39 Cloud storage: add test for simple save / load from our test account
This will fail if the proxy settings of the user running the test are
incorrect.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:57 -07:00
Dirk Hohndel
6eed3155e6 Add simple test for git storage
This just makes sure that writing data to git storage and reading it back
gives you the same result. Without the fixed generation of initial dive
site UUIDs this fails.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-25 10:43:41 -07:00
Robert C. Helling
fbce8a0378 Add a test for the VPM-B mode of the planner
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-23 07:30:33 -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