Changeset acd791b in subsurface


Ignore:
Timestamp:
Apr 1, 2017, 8:06:09 AM (3 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
841d1b4
Parents:
a0ed0ff
git-author:
Miika Turkia <miika.turkia@…> (03/13/17 21:58:59)
git-committer:
Dirk Hohndel <dirk@…> (04/01/17 08:06:09)
Message:

Export-import test for manual CSV

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@…>

Location:
tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/testparse.cpp

    ra0ed0ff racd791b  
    405405}
    406406
     407int TestParse::parseCSVmanual(int units, std::string file)
     408{
     409        verbose = 1;
     410        char *params[55];
     411        int pnr = 0;
     412
     413        params[pnr++] = strdup(strdup("numberField"));
     414        params[pnr++] = intdup(0);
     415        params[pnr++] = strdup("dateField");
     416        params[pnr++] = intdup(1);
     417        params[pnr++] = strdup("timeField");
     418        params[pnr++] = intdup(2);
     419        params[pnr++] = strdup("durationField");
     420        params[pnr++] = intdup(3);
     421        params[pnr++] = strdup("locationField");
     422        params[pnr++] = intdup(13);
     423        params[pnr++] = strdup("gpsField");
     424        params[pnr++] = intdup(14);
     425        params[pnr++] = strdup("maxDepthField");
     426        params[pnr++] = intdup(4);
     427        params[pnr++] = strdup("meanDepthField");
     428        params[pnr++] = intdup(5);
     429        params[pnr++] = strdup("divemasterField");
     430        params[pnr++] = intdup(15);
     431        params[pnr++] = strdup("buddyField");
     432        params[pnr++] = intdup(16);
     433        params[pnr++] = strdup("suitField");
     434        params[pnr++] = intdup(17);
     435        params[pnr++] = strdup("notesField");
     436        params[pnr++] = intdup(20);
     437        params[pnr++] = strdup("weightField");
     438        params[pnr++] = intdup(21);
     439        params[pnr++] = strdup("tagsField");
     440        params[pnr++] = intdup(22);
     441        params[pnr++] = strdup("separatorIndex");
     442        params[pnr++] = intdup(0);
     443        params[pnr++] = strdup("units");
     444        params[pnr++] = intdup(units);
     445        params[pnr++] = strdup("datefmt");
     446        params[pnr++] = intdup(2);
     447        params[pnr++] = strdup("durationfmt");
     448        params[pnr++] = intdup(2);
     449        params[pnr++] = strdup("cylindersizeField");
     450        params[pnr++] = intdup(8);
     451        params[pnr++] = strdup("startpressureField");
     452        params[pnr++] = intdup(9);
     453        params[pnr++] = strdup("endpressureField");
     454        params[pnr++] = intdup(10);
     455        params[pnr++] = strdup("o2Field");
     456        params[pnr++] = intdup(11);
     457        params[pnr++] = strdup("heField");
     458        params[pnr++] = intdup(12);
     459        params[pnr++] = strdup("airtempField");
     460        params[pnr++] = intdup(6);
     461        params[pnr++] = strdup("watertempField");
     462        params[pnr++] = intdup(7);
     463        params[pnr++] = NULL;
     464
     465        return parse_manual_file(file.c_str(), params, pnr - 1);
     466}
     467
     468void TestParse::exportCSVDiveDetails()
     469{
     470        parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml");
     471
     472        export_dives_xslt("testcsvexportmanual.csv", 0, 0, "xml2manualcsv.xslt");
     473        export_dives_xslt("testcsvexportmanualimperial.csv", 0, 1, "xml2manualcsv.xslt");
     474
     475        clear_dive_file_data();
     476
     477        parseCSVmanual(1, "testcsvexportmanualimperial.csv");
     478        export_dives_xslt("testcsvexportmanual2.csv", 0, 0, "xml2manualcsv.xslt");
     479        save_dives("./testing.xml");
     480
     481        /*
     482         * Keeping the actual test disabled, until rounding errors and other bugs are fixed
     483         *
     484
     485        FILE_COMPARE("testcsvexportmanual2.csv",
     486                "testcsvexportmanual.csv");
     487        */
     488}
     489
     490void TestParse::testExport()
     491{
     492        exportCSVDiveDetails();
     493}
     494
     495
    407496QTEST_GUILESS_MAIN(TestParse)
  • tests/testparse.h

    ra0ed0ff racd791b  
    2424        void testParseMerge();
    2525
     26        int parseCSVmanual(int, std::string);
     27        void exportCSVDiveDetails();
     28        void testExport();
     29
    2630private:
    2731        sqlite3 *_sqlite3_handle = NULL;
Note: See TracChangeset for help on using the changeset viewer.