aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testparse.cpp
AgeCommit message (Collapse)Author
2020-05-04CSV import/export test: Add support for dive modeGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-04-24cleanup: move clearing of device nodes to clear_dive_file_data()Gravatar Berthold Stoeger
It makes no sense to keep the device nodes if all the other data is cleared. Let's do this automatically and not explicitly. This ensures that the function is also called on mobile. Currently it was only called on desktop. Weirdly, the parser-tests were expecting that the device nodes were not reset by clear_dive_file_data() and therefore divecomputers were accumulating in the test results. Thus, the additional computers had to be removed from the expected test results. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-11Grammar: replaces 'indexes' by 'indices'Gravatar Robert C. Helling
Grammar-nazi ran git grep -l 'indexes' | xargs sed -i '' -e 's/indexes/indices/g' to prevent future wincing when reading the source code. Unfortunatly, Qt itself is infected as in QModelIndexList QItemSelection::indexes() const Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-01-10code cleanup: use setPath to set directoryGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-08-08Cleanup: move error reporting function declarations to errorhelper.hGravatar Berthold Stoeger
Move the declarations of the "report_error()" and "set_error_cb()" functions and the "verbose" variable to errorhelper.h. Thus, error-reporting translation units don't have to import the big dive.h header file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: move trip-related functions into own translation unitGravatar Berthold Stoeger
These functions were spread out over dive.c and divelist.c. Move them into their own file to make all this a bit less monolithic. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive sites: prepare for dive site ref-countingGravatar Berthold Stoeger
Add a dive site table to each dive site to keep track of dives that have been added to a dive site. Add two functions to add dives to / remove dives from dive sites. Since dive sites now contain a dive table, the order of includes had to be changed: "divesite.h" now includes "dive.h" and not vice-versa. This caused some include churn. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Parser: parse into custom dive site tableGravatar Berthold Stoeger
To extend the undo system to dive sites, the importers and downloaders must not parse directly into the global dive site table. Instead, pass a dive_site_table argument to parse into. For now, always pass the global dive_site_table so that this commit should not cause any functional change. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive site: add dive site table parameter to dive site functionsGravatar Berthold Stoeger
To enable undo of dive site functions, it is crucial to work with different dive site tables. Therefore add a dive site table parameter to dive site functions. For now, always pass the global dive site table. Thus, this commit shouldn't alter any functionality. After this change, a simple search for dive_site_table reveals all places where the global dive site table is accessed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09Parser: add trip_table parameter to parsing functionsGravatar Berthold Stoeger
To allow parsing into arbitrary trip_tables, add the corresponding parameter to the parsing functions and the parser state. Currently, all callers pass the global trip_table so there should be no change in functionality. These arguments will be replaced in subsequent commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-28Parser: parse text-based files into arbitrary tableGravatar Berthold Stoeger
In d815e0c9476ef62e6b84fb28ce48ab7cddefe77e a dive_table pointer was added to the parsing functions to allow parsing into tables other than the global dive table. This will be necessary for undo of import and implementation a cleaner interface. A few cases, notably CSV and proprietary formats were forgotten. Implement parsing into arbitrary tables also for these cases. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-28Cleanup: remove redundant prototypes from dive.hGravatar Berthold Stoeger
A few of these prototypes were already in import-csv.h. Put them in an 'extern "C" { ... }' block. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-13Optional anonymization upon exportGravatar Robert C. Helling
Add a checkbox that triggers replacement of all English characters by x's in notes, buddy, dive guide and (while we are at it) suit. This is ment for people sharing logs for debugging that are concious about privacy issues. It leaves the lenth of strings in tact as well as special charcters as those might be needed to track down a particular parsing problem. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-08-23Parse: pass dive_table argument to parse_file()Gravatar Berthold Stoeger
To enable undo of divelog-importing it is crucial that parse_file() can parse into arbitrary dive tables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-26Whitespace cleanup testsGravatar Dirk Hohndel
Again, entirely script based. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14Core: introduce new subsurface-string headerGravatar Dirk Hohndel
First small step to shrinking dive.h. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-19CSV import: fix setpoint (typo)Gravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-03-19CSV import/export: Sort parameter list and add commentGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-08Parameter size needs to be increased for testGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08Update DL7 tests to current importGravatar Miika Turkia
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-08Compare DL7 import to saved conversionGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-01-08Add test for DL7 importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-27Refactore parse-xml.c into parse.c and parse-xml.cGravatar Miika Turkia
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-27Add test for DM5 importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-27Fix some warningsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-12Test case for CSV profile export to imperial and backGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07Merge branch 'seabear-refactor'Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-07Change test case to use new Seabear parsing functionGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-07Move intdup to qthelperGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06Enable test mode in UDDF export testGravatar Miika Turkia
Using the units parameter to indicate test mode on UDDF export. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06Add UDDF export-import testGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-05-06Fix memory leakGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-29Add SPDX header to testsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-01Cleanup for CSV testingGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01Enable CSV import-export unit conversion testGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-04-01Export-import test for manual CSVGravatar Miika Turkia
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-01Change parseCSV to support unit and file selectionGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-03-04Rework TestParse to make tests independent from each otherGravatar Jeremie Guichard
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-04Use proper order in QCOMPARE argumentsGravatar Jeremie Guichard
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-02-25Fix trailing '\r' test failure on WindowsGravatar Jeremie Guichard
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-24Use SUBSURFACE_TEST_DATA definition to point to test data dirGravatar Jeremie Guichard
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-09Add test for merging multiple cylindersGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09Reenable all of TestParseGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-09Fix dive number comparison for Seabear import testsGravatar Miika Turkia
2017-02-09Add numberField parameter for parse testingGravatar Miika Turkia
2017-02-09Fix typo on parse testingGravatar Miika Turkia
2017-02-06TestParse: disable failing testsGravatar Dirk Hohndel
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-06TestParse: prevent crashesGravatar Dirk Hohndel
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-05TestParse: make sure we get one dive from SeabearHUDCGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-05Our tests are actually GUILESSGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>