diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testdivesiteduplication.cpp | 2 | ||||
-rw-r--r-- | tests/testgitstorage.cpp | 46 | ||||
-rw-r--r-- | tests/testmerge.cpp | 8 | ||||
-rw-r--r-- | tests/testparse.cpp | 18 | ||||
-rw-r--r-- | tests/testpicture.cpp | 2 | ||||
-rw-r--r-- | tests/testprofile.cpp | 2 | ||||
-rw-r--r-- | tests/testrenumber.cpp | 6 |
7 files changed, 42 insertions, 42 deletions
diff --git a/tests/testdivesiteduplication.cpp b/tests/testdivesiteduplication.cpp index 4e90c5175..250e407fc 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"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/TwoTimesTwo.ssrf", &dive_table), 0); QCOMPARE(dive_site_table.nr, 2); } diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp index 1448c60ac..43c5ed03a 100644 --- a/tests/testgitstorage.cpp +++ b/tests/testgitstorage.cpp @@ -88,7 +88,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"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf", &dive_table), 0); QFETCH(QString, testDirName); QFETCH(QString, prefixRead); QFETCH(QString, prefixWrite); @@ -101,7 +101,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]")), 0); + QCOMPARE(parse_file(qPrintable(repoNameRead + "[test]"), &dive_table), 0); QCOMPARE(save_dives("./SampleDivesV3viagit.ssrf"), 0); QFile org("./SampleDivesV3.ssrf"); org.open(QFile::ReadOnly); @@ -120,10 +120,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"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf", &dive_table), 0); QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0); clear_dive_file_data(); - QCOMPARE(parse_file(qPrintable(cloudTestRepo)), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0); QCOMPARE(save_dives("./SampleDivesV3viacloud.ssrf"), 0); QFile org("./SampleDivesV3.ssrf"); org.open(QFile::ReadOnly); @@ -144,8 +144,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)), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test10.xml"), 0); + QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test10.xml", &dive_table), 0); // calling process_dive() sorts the table, but calling it with // is_imported == true causes it to try to update the window title... let's not do that process_dives(false, false); @@ -154,7 +154,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)), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0); QCOMPARE(save_dives("./SampleDivesV3plus10viacloud.ssrf"), 0); QFile org("./SampleDivesV3plus10local.ssrf"); org.open(QFile::ReadOnly); @@ -172,7 +172,7 @@ void TestGitStorage::testGitStorageCloudOfflineSync() QDir localCacheDirectorySave(localCacheDir + "save"); QCOMPARE(localCacheDirectorySave.removeRecursively(), true); QCOMPARE(localCacheDirectory.rename(localCacheDir, localCacheDir + "save"), true); - QCOMPARE(parse_file(qPrintable(cloudTestRepo)), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0); QCOMPARE(save_dives("./SampleDivesV3plus10fromcloud.ssrf"), 0); org.close(); org.open(QFile::ReadOnly); @@ -193,15 +193,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)), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml"), 0); + QCOMPARE(parse_file(qPrintable(localCacheRepoSave), &dive_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table), 0); process_dives(false, false); 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)), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml"), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table), 0); process_dives(false, false); QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0); clear_dive_file_data(); @@ -212,13 +212,13 @@ void TestGitStorage::testGitStorageCloudMerge() QCOMPARE(localCacheDirectory.removeRecursively(), true); QDir localCacheDirectorySave(localCacheDir + "save"); QCOMPARE(localCacheDirectory.rename(localCacheDir + "save", localCacheDir), true); - QCOMPARE(parse_file(qPrintable(cloudTestRepo)), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0); QCOMPARE(save_dives("./SampleDivesV3plus10-11-12-merged.ssrf"), 0); clear_dive_file_data(); - QCOMPARE(parse_file("./SampleDivesV3plus10local.ssrf"), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml"), 0); + QCOMPARE(parse_file("./SampleDivesV3plus10local.ssrf", &dive_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table), 0); process_dives(false, false); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table), 0); process_dives(false, false); QCOMPARE(save_dives("./SampleDivesV3plus10-11-12.ssrf"), 0); QFile org("./SampleDivesV3plus10-11-12-merged.ssrf"); @@ -240,7 +240,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)), 0); + QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table), 0); process_dives(false, false); struct dive *dive = get_dive(1); delete_single_dive(1); @@ -256,7 +256,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)), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0); process_dives(false, false); dive = get_dive(1); QVERIFY(dive != NULL); @@ -272,7 +272,7 @@ void TestGitStorage::testGitStorageCloudMerge2() QCOMPARE(localCacheDirectory.removeRecursively(), true); QCOMPARE(localCacheDirectorySave.rename(localCacheDir + "save", localCacheDir), true); - QCOMPARE(parse_file(qPrintable(cloudTestRepo)), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0); QCOMPARE(save_dives("./SampleDivesMinus1-merged.ssrf"), 0); QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0); QFile org("./SampleDivesMinus1-merged.ssrf"); @@ -296,7 +296,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)), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0); process_dives(false, false); struct dive *dive = get_dive(0); QVERIFY(dive != 0); @@ -308,7 +308,7 @@ void TestGitStorage::testGitStorageCloudMerge3() QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0); clear_dive_file_data(); - QCOMPARE(parse_file(qPrintable(localCacheRepo)), 0); + QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table), 0); process_dives(false, false); dive = get_dive(0); dive->notes = strdup("Create multi line dive notes\nDifferent line 2 and removed 3-5\n\nThat should be enough"); @@ -327,7 +327,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)), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0); process_dives(false, false); dive = get_dive(0); dive->notes = strdup("Completely different dive notes\nBut also multi line"); @@ -345,7 +345,7 @@ void TestGitStorage::testGitStorageCloudMerge3() QCOMPARE(localCacheDirectory.removeRecursively(), true); QCOMPARE(localCacheDirectorySave.rename(localCacheDir + "save", localCacheDir), true); - QCOMPARE(parse_file(qPrintable(cloudTestRepo)), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_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 a664e1a35..b102e239f 100644 --- a/tests/testmerge.cpp +++ b/tests/testmerge.cpp @@ -21,9 +21,9 @@ void TestMerge::testMergeEmpty() /* * check that we correctly merge mixed cylinder dives */ - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &dive_table), 0); process_dives(true, false); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &dive_table), 0); process_dives(true, false); QCOMPARE(save_dives("./testmerge47+48.ssrf"), 0); QFile org(SUBSURFACE_TEST_DATA "/dives/test47+48.xml"); @@ -44,9 +44,9 @@ void TestMerge::testMergeBackwards() /* * check that we correctly merge mixed cylinder dives */ - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &dive_table), 0); process_dives(true, false); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &dive_table), 0); process_dives(true, false); 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 06e20cd5c..59531af70 100644 --- a/tests/testparse.cpp +++ b/tests/testparse.cpp @@ -127,13 +127,13 @@ int TestParse::parseDivingLog() int TestParse::parseV2NoQuestion() { // parsing of a V2 file should work - return parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml"); + return parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table); } int TestParse::parseV3() { // parsing of a V3 files should succeed - return parse_file(SUBSURFACE_TEST_DATA "/dives/test42.xml"); + return parse_file(SUBSURFACE_TEST_DATA "/dives/test42.xml", &dive_table); } void TestParse::testParse() @@ -279,7 +279,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()) > 0); + QVERIFY(try_to_open_zip(filename.toLatin1().data(), &dive_table) > 0); fprintf(stderr, "number of dives from DLD: %d \n", dive_table.nr); @@ -299,8 +299,8 @@ void TestParse::testParseMerge() /* * check that we correctly merge mixed cylinder dives */ - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/ostc.xml"), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/vyper.xml"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/ostc.xml", &dive_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/vyper.xml", &dive_table), 0); QCOMPARE(save_dives("./testmerge.ssrf"), 0); FILE_COMPARE("./testmerge.ssrf", SUBSURFACE_TEST_DATA "/dives/mergedVyperOstc.xml"); @@ -371,7 +371,7 @@ int TestParse::parseCSVmanual(int units, std::string file) void TestParse::exportCSVDiveDetails() { - parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml"); + parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table); export_dives_xslt("testcsvexportmanual.csv", 0, 0, "xml2manualcsv.xslt"); export_dives_xslt("testcsvexportmanualimperial.csv", 0, 1, "xml2manualcsv.xslt"); @@ -420,7 +420,7 @@ int TestParse::parseCSVprofile(int units, std::string file) void TestParse::exportCSVDiveProfile() { - parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml"); + parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table); export_dives_xslt("testcsvexportprofile.csv", 0, 0, "xml2csv.xslt"); export_dives_xslt("testcsvexportprofileimperial.csv", 0, 1, "xml2csv.xslt"); @@ -438,13 +438,13 @@ void TestParse::exportCSVDiveProfile() void TestParse::exportUDDF() { - parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml"); + parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table); export_dives_xslt("testuddfexport.uddf", 0, 1, "uddf-export.xslt"); clear_dive_file_data(); - parse_file("testuddfexport.uddf"); + parse_file("testuddfexport.uddf", &dive_table); export_dives_xslt("testuddfexport2.uddf", 0, 1, "uddf-export.xslt"); FILE_COMPARE("testuddfexport.uddf", diff --git a/tests/testpicture.cpp b/tests/testpicture.cpp index 507a3cf79..2209e479f 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"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test44.xml", &dive_table), 0); dive = get_dive(0); QVERIFY(dive != NULL); pic1 = dive->picture_list; diff --git a/tests/testprofile.cpp b/tests/testprofile.cpp index 1a63efa56..ce7702b3e 100644 --- a/tests/testprofile.cpp +++ b/tests/testprofile.cpp @@ -4,7 +4,7 @@ void TestProfile::testRedCeiling() { - parse_file("../dives/deep.xml"); + parse_file("../dives/deep.xml", &dive_table); } QTEST_GUILESS_MAIN(TestProfile) diff --git a/tests/testrenumber.cpp b/tests/testrenumber.cpp index 9b5a7f4af..f6a628083 100644 --- a/tests/testrenumber.cpp +++ b/tests/testrenumber.cpp @@ -7,14 +7,14 @@ void TestRenumber::setup() { - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &dive_table), 0); process_dives(false, false); dive_table.preexisting = dive_table.nr; } void TestRenumber::testMerge() { - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml", &dive_table), 0); process_dives(true, false); QCOMPARE(dive_table.nr, 1); QCOMPARE(unsaved_changes(), 1); @@ -24,7 +24,7 @@ void TestRenumber::testMerge() void TestRenumber::testMergeAndAppend() { - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml"), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml", &dive_table), 0); process_dives(true, false); QCOMPARE(dive_table.nr, 2); QCOMPARE(unsaved_changes(), 1); |