summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-02-28 22:45:17 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit37146c5742503becf75468fb07aab56011cb9101 (patch)
tree666e4d609b3d9b882082fcc258d6d153c6c68fa5 /tests
parent926b6895bbce7cc539ca4d0c3a425876dfa33d6b (diff)
downloadsubsurface-37146c5742503becf75468fb07aab56011cb9101.tar.gz
Parser: parse into custom dive site table
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/testdivesiteduplication.cpp2
-rw-r--r--tests/testgitstorage.cpp46
-rw-r--r--tests/testmerge.cpp8
-rw-r--r--tests/testparse.cpp36
-rw-r--r--tests/testparseperformance.cpp6
-rw-r--r--tests/testpicture.cpp2
-rw-r--r--tests/testprofile.cpp2
-rw-r--r--tests/testrenumber.cpp6
8 files changed, 54 insertions, 54 deletions
diff --git a/tests/testdivesiteduplication.cpp b/tests/testdivesiteduplication.cpp
index f70da5621..4b770d311 100644
--- a/tests/testdivesiteduplication.cpp
+++ b/tests/testdivesiteduplication.cpp
@@ -5,7 +5,7 @@
void TestDiveSiteDuplication::testReadV2()
{
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/TwoTimesTwo.ssrf", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/TwoTimesTwo.ssrf", &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(dive_site_table.nr, 2);
}
diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp
index dfe64a3b3..e4b22a713 100644
--- a/tests/testgitstorage.cpp
+++ b/tests/testgitstorage.cpp
@@ -79,7 +79,7 @@ void TestGitStorage::testGitStorageLocal()
// test writing and reading back from local git storage
git_repository *repo;
git_libgit2_init();
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf", &dive_table, &trip_table, &dive_site_table), 0);
QFETCH(QString, testDirName);
QFETCH(QString, prefixRead);
QFETCH(QString, prefixWrite);
@@ -92,7 +92,7 @@ void TestGitStorage::testGitStorageLocal()
QCOMPARE(save_dives(qPrintable(repoNameWrite + "[test]")), 0);
QCOMPARE(save_dives("./SampleDivesV3.ssrf"), 0);
clear_dive_file_data();
- QCOMPARE(parse_file(qPrintable(repoNameRead + "[test]"), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(repoNameRead + "[test]"), &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives("./SampleDivesV3viagit.ssrf"), 0);
QFile org("./SampleDivesV3.ssrf");
org.open(QFile::ReadOnly);
@@ -111,10 +111,10 @@ void TestGitStorage::testGitStorageCloud()
// connect to the ssrftest repository on the cloud server
// and repeat the same test as before with the local git storage
QString cloudTestRepo("https://cloud.subsurface-divelog.org/git/ssrftest@hohndel.org[ssrftest@hohndel.org]");
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf", &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0);
clear_dive_file_data();
- QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives("./SampleDivesV3viacloud.ssrf"), 0);
QFile org("./SampleDivesV3.ssrf");
org.open(QFile::ReadOnly);
@@ -135,8 +135,8 @@ void TestGitStorage::testGitStorageCloudOfflineSync()
QString localCacheDir(get_local_dir("https://cloud.subsurface-divelog.org/git/ssrftest@hohndel.org", "ssrftest@hohndel.org"));
QString localCacheRepo = localCacheDir + "[ssrftest@hohndel.org]";
// read the local repo from the previous test and add dive 10
- QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table, &trip_table), 0);
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test10.xml", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table, &trip_table, &dive_site_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test10.xml", &dive_table, &trip_table, &dive_site_table), 0);
// calling process_loaded_dives() sorts the table, but calling add_imported_dives()
// causes it to try to update the window title... let's not do that
process_loaded_dives();
@@ -145,7 +145,7 @@ void TestGitStorage::testGitStorageCloudOfflineSync()
QCOMPARE(save_dives("./SampleDivesV3plus10local.ssrf"), 0);
clear_dive_file_data();
// open the cloud storage and compare
- QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives("./SampleDivesV3plus10viacloud.ssrf"), 0);
QFile org("./SampleDivesV3plus10local.ssrf");
org.open(QFile::ReadOnly);
@@ -163,7 +163,7 @@ void TestGitStorage::testGitStorageCloudOfflineSync()
QDir localCacheDirectorySave(localCacheDir + "save");
QCOMPARE(localCacheDirectorySave.removeRecursively(), true);
QCOMPARE(localCacheDirectory.rename(localCacheDir, localCacheDir + "save"), true);
- QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives("./SampleDivesV3plus10fromcloud.ssrf"), 0);
org.close();
org.open(QFile::ReadOnly);
@@ -184,15 +184,15 @@ void TestGitStorage::testGitStorageCloudMerge()
QString cloudTestRepo("https://cloud.subsurface-divelog.org/git/ssrftest@hohndel.org[ssrftest@hohndel.org]");
QString localCacheDir(get_local_dir("https://cloud.subsurface-divelog.org/git/ssrftest@hohndel.org", "ssrftest@hohndel.org"));
QString localCacheRepoSave = localCacheDir + "save[ssrftest@hohndel.org]";
- QCOMPARE(parse_file(qPrintable(localCacheRepoSave), &dive_table, &trip_table), 0);
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(localCacheRepoSave), &dive_table, &trip_table, &dive_site_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table, &trip_table, &dive_site_table), 0);
process_loaded_dives();
QCOMPARE(save_dives(qPrintable(localCacheRepoSave)), 0);
clear_dive_file_data();
// now we open the cloud storage repo and add a different dive to it
- QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table), 0);
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table, &trip_table, &dive_site_table), 0);
process_loaded_dives();
QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0);
clear_dive_file_data();
@@ -203,13 +203,13 @@ void TestGitStorage::testGitStorageCloudMerge()
QCOMPARE(localCacheDirectory.removeRecursively(), true);
QDir localCacheDirectorySave(localCacheDir + "save");
QCOMPARE(localCacheDirectory.rename(localCacheDir + "save", localCacheDir), true);
- QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives("./SampleDivesV3plus10-11-12-merged.ssrf"), 0);
clear_dive_file_data();
- QCOMPARE(parse_file("./SampleDivesV3plus10local.ssrf", &dive_table, &trip_table), 0);
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file("./SampleDivesV3plus10local.ssrf", &dive_table, &trip_table, &dive_site_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table, &trip_table, &dive_site_table), 0);
process_loaded_dives();
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table, &trip_table, &dive_site_table), 0);
process_loaded_dives();
QCOMPARE(save_dives("./SampleDivesV3plus10-11-12.ssrf"), 0);
QFile org("./SampleDivesV3plus10-11-12-merged.ssrf");
@@ -231,7 +231,7 @@ void TestGitStorage::testGitStorageCloudMerge2()
QString cloudTestRepo("https://cloud.subsurface-divelog.org/git/ssrftest@hohndel.org[ssrftest@hohndel.org]");
QString localCacheDir(get_local_dir("https://cloud.subsurface-divelog.org/git/ssrftest@hohndel.org", "ssrftest@hohndel.org"));
QString localCacheRepo = localCacheDir + "[ssrftest@hohndel.org]";
- QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table, &trip_table, &dive_site_table), 0);
process_loaded_dives();
struct dive *dive = get_dive(1);
delete_single_dive(1);
@@ -247,7 +247,7 @@ void TestGitStorage::testGitStorageCloudMerge2()
QCOMPARE(localCacheDirectory.rename(localCacheDir, localCacheDir + "save"), true);
}
// now we open the cloud storage repo and modify that first dive
- QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0);
process_loaded_dives();
dive = get_dive(1);
QVERIFY(dive != NULL);
@@ -263,7 +263,7 @@ void TestGitStorage::testGitStorageCloudMerge2()
QCOMPARE(localCacheDirectory.removeRecursively(), true);
QCOMPARE(localCacheDirectorySave.rename(localCacheDir + "save", localCacheDir), true);
- QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives("./SampleDivesMinus1-merged.ssrf"), 0);
QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0);
QFile org("./SampleDivesMinus1-merged.ssrf");
@@ -287,7 +287,7 @@ void TestGitStorage::testGitStorageCloudMerge3()
QString cloudTestRepo("https://cloud.subsurface-divelog.org/git/ssrftest@hohndel.org[ssrftest@hohndel.org]");
QString localCacheDir(get_local_dir("https://cloud.subsurface-divelog.org/git/ssrftest@hohndel.org", "ssrftest@hohndel.org"));
QString localCacheRepo = localCacheDir + "[ssrftest@hohndel.org]";
- QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0);
process_loaded_dives();
struct dive *dive = get_dive(0);
QVERIFY(dive != 0);
@@ -299,7 +299,7 @@ void TestGitStorage::testGitStorageCloudMerge3()
QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0);
clear_dive_file_data();
- QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table, &trip_table, &dive_site_table), 0);
process_loaded_dives();
dive = get_dive(0);
dive->notes = strdup("Create multi line dive notes\nDifferent line 2 and removed 3-5\n\nThat should be enough");
@@ -318,7 +318,7 @@ void TestGitStorage::testGitStorageCloudMerge3()
QCOMPARE(localCacheDirectory.rename(localCacheDir, localCacheDir + "save"), true);
}
// now we open the cloud storage repo and modify those first dive notes differently
- QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0);
process_loaded_dives();
dive = get_dive(0);
dive->notes = strdup("Completely different dive notes\nBut also multi line");
@@ -336,7 +336,7 @@ void TestGitStorage::testGitStorageCloudMerge3()
QCOMPARE(localCacheDirectory.removeRecursively(), true);
QCOMPARE(localCacheDirectorySave.rename(localCacheDir + "save", localCacheDir), true);
- QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives("./SampleDivesMerge3.ssrf"), 0);
// we are not trying to compare this to a pre-determined result... what this test
// checks is that there are no parsing errors with the merge
diff --git a/tests/testmerge.cpp b/tests/testmerge.cpp
index 7b1e84149..70f22ee73 100644
--- a/tests/testmerge.cpp
+++ b/tests/testmerge.cpp
@@ -23,9 +23,9 @@ void TestMerge::testMergeEmpty()
*/
struct dive_table table = { 0 };
struct trip_table trips = { 0 };
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips, &dive_site_table), 0);
add_imported_dives(&table, &trips, IMPORT_MERGE_ALL_TRIPS);
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips, &dive_site_table), 0);
add_imported_dives(&table, &trips, IMPORT_MERGE_ALL_TRIPS);
QCOMPARE(save_dives("./testmerge47+48.ssrf"), 0);
QFile org(SUBSURFACE_TEST_DATA "/dives/test47+48.xml");
@@ -48,9 +48,9 @@ void TestMerge::testMergeBackwards()
*/
struct dive_table table = { 0 };
struct trip_table trips = { 0 };
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips, &dive_site_table), 0);
add_imported_dives(&table, &trips, IMPORT_MERGE_ALL_TRIPS);
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips, &dive_site_table), 0);
add_imported_dives(&table, &trips, IMPORT_MERGE_ALL_TRIPS);
QCOMPARE(save_dives("./testmerge47+48.ssrf"), 0);
QFile org(SUBSURFACE_TEST_DATA "/dives/test47+48.xml");
diff --git a/tests/testparse.cpp b/tests/testparse.cpp
index 2a90f5a0f..0a751cf11 100644
--- a/tests/testparse.cpp
+++ b/tests/testparse.cpp
@@ -107,7 +107,7 @@ int TestParse::parseCSV(int units, std::string file)
params[pnr++] = intdup(-1);
params[pnr++] = NULL;
- return parse_manual_file(file.c_str(), params, pnr - 1, &dive_table, &trip_table);
+ return parse_manual_file(file.c_str(), params, pnr - 1, &dive_table, &trip_table, &dive_site_table);
}
int TestParse::parseDivingLog()
@@ -118,7 +118,7 @@ int TestParse::parseDivingLog()
int ret = sqlite3_open(SUBSURFACE_TEST_DATA "/dives/TestDivingLog4.1.1.sql", &_sqlite3_handle);
if (ret == 0)
- ret = parse_divinglog_buffer(_sqlite3_handle, 0, 0, 0, &dive_table, &trip_table);
+ ret = parse_divinglog_buffer(_sqlite3_handle, 0, 0, 0, &dive_table, &trip_table, &dive_site_table);
else
fprintf(stderr, "Can't open sqlite3 db: " SUBSURFACE_TEST_DATA "/dives/TestDivingLog4.1.1.sql");
@@ -128,13 +128,13 @@ int TestParse::parseDivingLog()
int TestParse::parseV2NoQuestion()
{
// parsing of a V2 file should work
- return parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table);
+ return parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table);
}
int TestParse::parseV3()
{
// parsing of a V3 files should succeed
- return parse_file(SUBSURFACE_TEST_DATA "/dives/test42.xml", &dive_table, &trip_table);
+ return parse_file(SUBSURFACE_TEST_DATA "/dives/test42.xml", &dive_table, &trip_table, &dive_site_table);
}
void TestParse::testParse()
@@ -159,7 +159,7 @@ void TestParse::testParse()
void TestParse::testParseDM4()
{
QCOMPARE(sqlite3_open(SUBSURFACE_TEST_DATA "/dives/TestDiveDM4.db", &_sqlite3_handle), 0);
- QCOMPARE(parse_dm4_buffer(_sqlite3_handle, 0, 0, 0, &dive_table, &trip_table), 0);
+ QCOMPARE(parse_dm4_buffer(_sqlite3_handle, 0, 0, 0, &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives("./testdm4out.ssrf"), 0);
FILE_COMPARE("./testdm4out.ssrf",
@@ -169,7 +169,7 @@ void TestParse::testParseDM4()
void TestParse::testParseDM5()
{
QCOMPARE(sqlite3_open(SUBSURFACE_TEST_DATA "/dives/TestDiveDM5.db", &_sqlite3_handle), 0);
- QCOMPARE(parse_dm5_buffer(_sqlite3_handle, 0, 0, 0, &dive_table, &trip_table), 0);
+ QCOMPARE(parse_dm5_buffer(_sqlite3_handle, 0, 0, 0, &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives("./testdm5out.ssrf"), 0);
FILE_COMPARE("./testdm5out.ssrf",
@@ -216,7 +216,7 @@ void TestParse::testParseHUDC()
params[pnr++] = NULL;
QCOMPARE(parse_csv_file(SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearHUDC.csv",
- params, pnr - 1, "csv", &dive_table, &trip_table),
+ params, pnr - 1, "csv", &dive_table, &trip_table, &dive_site_table),
0);
QCOMPARE(dive_table.nr, 1);
@@ -261,7 +261,7 @@ void TestParse::testParseNewFormat()
"/dives/")
.append(files.at(i))
.toLatin1()
- .data(), &dive_table, &trip_table),
+ .data(), &dive_table, &trip_table, &dive_site_table),
0);
QCOMPARE(dive_table.nr, i + 1);
}
@@ -280,7 +280,7 @@ void TestParse::testParseDLD()
QString filename = SUBSURFACE_TEST_DATA "/dives/TestDiveDivelogsDE.DLD";
QVERIFY(readfile(filename.toLatin1().data(), &mem) > 0);
- QVERIFY(try_to_open_zip(filename.toLatin1().data(), &dive_table, &trip_table) > 0);
+ QVERIFY(try_to_open_zip(filename.toLatin1().data(), &dive_table, &trip_table, &dive_site_table) > 0);
fprintf(stderr, "number of dives from DLD: %d \n", dive_table.nr);
@@ -300,8 +300,8 @@ void TestParse::testParseMerge()
/*
* check that we correctly merge mixed cylinder dives
*/
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/ostc.xml", &dive_table, &trip_table), 0);
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/vyper.xml", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/ostc.xml", &dive_table, &trip_table, &dive_site_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/vyper.xml", &dive_table, &trip_table, &dive_site_table), 0);
QCOMPARE(save_dives("./testmerge.ssrf"), 0);
FILE_COMPARE("./testmerge.ssrf",
SUBSURFACE_TEST_DATA "/dives/mergedVyperOstc.xml");
@@ -367,12 +367,12 @@ int TestParse::parseCSVmanual(int units, std::string file)
params[pnr++] = intdup(units);
params[pnr++] = NULL;
- return parse_manual_file(file.c_str(), params, pnr - 1, &dive_table, &trip_table);
+ return parse_manual_file(file.c_str(), params, pnr - 1, &dive_table, &trip_table, &dive_site_table);
}
void TestParse::exportCSVDiveDetails()
{
- parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table);
+ parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table);
export_dives_xslt("testcsvexportmanual.csv", 0, 0, "xml2manualcsv.xslt", false);
export_dives_xslt("testcsvexportmanualimperial.csv", 0, 1, "xml2manualcsv.xslt", false);
@@ -416,12 +416,12 @@ int TestParse::parseCSVprofile(int units, std::string file)
params[pnr++] = intdup(units);
params[pnr++] = NULL;
- return parse_csv_file(file.c_str(), params, pnr - 1, "csv", &dive_table, &trip_table);
+ return parse_csv_file(file.c_str(), params, pnr - 1, "csv", &dive_table, &trip_table, &dive_site_table);
}
void TestParse::exportCSVDiveProfile()
{
- parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table);
+ parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table);
export_dives_xslt("testcsvexportprofile.csv", 0, 0, "xml2csv.xslt", false);
export_dives_xslt("testcsvexportprofileimperial.csv", 0, 1, "xml2csv.xslt", false);
@@ -439,13 +439,13 @@ void TestParse::exportCSVDiveProfile()
void TestParse::exportUDDF()
{
- parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table);
+ parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table);
export_dives_xslt("testuddfexport.uddf", 0, 1, "uddf-export.xslt", false);
clear_dive_file_data();
- parse_file("testuddfexport.uddf", &dive_table, &trip_table);
+ parse_file("testuddfexport.uddf", &dive_table, &trip_table, &dive_site_table);
export_dives_xslt("testuddfexport2.uddf", 0, 1, "uddf-export.xslt", false);
FILE_COMPARE("testuddfexport.uddf",
@@ -510,7 +510,7 @@ void TestParse::parseDL7()
clear_dive_file_data();
QCOMPARE(parse_csv_file(SUBSURFACE_TEST_DATA "/dives/DL7.zxu",
- params, pnr - 1, "DL7", &dive_table, &trip_table),
+ params, pnr - 1, "DL7", &dive_table, &trip_table, &dive_site_table),
0);
QCOMPARE(dive_table.nr, 3);
diff --git a/tests/testparseperformance.cpp b/tests/testparseperformance.cpp
index c850892ff..64625f269 100644
--- a/tests/testparseperformance.cpp
+++ b/tests/testparseperformance.cpp
@@ -63,7 +63,7 @@ void TestParsePerformance::parseSsrf()
return;
}
QBENCHMARK {
- parse_file(SUBSURFACE_TEST_DATA "/dives/large-anon.ssrf", &dive_table, &trip_table);
+ parse_file(SUBSURFACE_TEST_DATA "/dives/large-anon.ssrf", &dive_table, &trip_table, &dive_site_table);
}
}
@@ -74,12 +74,12 @@ void TestParsePerformance::parseGit()
// first parse this once to populate the local cache - this way network
// effects don't dominate the parse time
- parse_file(LARGE_TEST_REPO "[git]", &dive_table, &trip_table);
+ parse_file(LARGE_TEST_REPO "[git]", &dive_table, &trip_table, &dive_site_table);
cleanup();
QBENCHMARK {
- parse_file(LARGE_TEST_REPO "[git]", &dive_table, &trip_table);
+ parse_file(LARGE_TEST_REPO "[git]", &dive_table, &trip_table, &dive_site_table);
}
}
diff --git a/tests/testpicture.cpp b/tests/testpicture.cpp
index 4bb33bd84..0e369b937 100644
--- a/tests/testpicture.cpp
+++ b/tests/testpicture.cpp
@@ -23,7 +23,7 @@ void TestPicture::addPicture()
struct picture *pic1, *pic2;
verbose = 1;
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test44.xml", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test44.xml", &dive_table, &trip_table, &dive_site_table), 0);
dive = get_dive(0);
// Pictures will be added to selected dives
dive->selected = true;
diff --git a/tests/testprofile.cpp b/tests/testprofile.cpp
index 48483f9ff..a093c9fe9 100644
--- a/tests/testprofile.cpp
+++ b/tests/testprofile.cpp
@@ -4,7 +4,7 @@
void TestProfile::testRedCeiling()
{
- parse_file("../dives/deep.xml", &dive_table, &trip_table);
+ parse_file("../dives/deep.xml", &dive_table, &trip_table, &dive_site_table);
}
QTEST_GUILESS_MAIN(TestProfile)
diff --git a/tests/testrenumber.cpp b/tests/testrenumber.cpp
index 0b766f3cb..d674c4922 100644
--- a/tests/testrenumber.cpp
+++ b/tests/testrenumber.cpp
@@ -7,7 +7,7 @@
void TestRenumber::setup()
{
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &dive_table, &trip_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &dive_table, &trip_table, &dive_site_table), 0);
process_loaded_dives();
}
@@ -15,7 +15,7 @@ void TestRenumber::testMerge()
{
struct dive_table table = { 0 };
struct trip_table trips = { 0 };
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml", &table, &trip_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml", &table, &trip_table, &dive_site_table), 0);
add_imported_dives(&table, &trips, IMPORT_MERGE_ALL_TRIPS);
QCOMPARE(dive_table.nr, 1);
QCOMPARE(unsaved_changes(), 1);
@@ -26,7 +26,7 @@ void TestRenumber::testMergeAndAppend()
{
struct dive_table table = { 0 };
struct trip_table trips = { 0 };
- QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml", &table, &trip_table), 0);
+ QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml", &table, &trip_table, &dive_site_table), 0);
add_imported_dives(&table, &trips, IMPORT_MERGE_ALL_TRIPS);
QCOMPARE(dive_table.nr, 2);
QCOMPARE(unsaved_changes(), 1);