mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Test case for CSV profile export to imperial and back
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
parent
f2e23e7815
commit
726c9e859c
2 changed files with 50 additions and 0 deletions
|
@ -370,6 +370,53 @@ void TestParse::exportCSVDiveDetails()
|
||||||
clear_dive_file_data();
|
clear_dive_file_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TestParse::parseCSVprofile(int units, std::string file)
|
||||||
|
{
|
||||||
|
verbose = 1;
|
||||||
|
char *params[55];
|
||||||
|
int pnr = 0;
|
||||||
|
|
||||||
|
params[pnr++] = strdup("dateField");
|
||||||
|
params[pnr++] = intdup(1);
|
||||||
|
params[pnr++] = strdup("datefmt");
|
||||||
|
params[pnr++] = intdup(2);
|
||||||
|
params[pnr++] = strdup("starttimeField");
|
||||||
|
params[pnr++] = intdup(2);
|
||||||
|
params[pnr++] = strdup("numberField");
|
||||||
|
params[pnr++] = intdup(0);
|
||||||
|
params[pnr++] = strdup("timeField");
|
||||||
|
params[pnr++] = intdup(3);
|
||||||
|
params[pnr++] = strdup("depthField");
|
||||||
|
params[pnr++] = intdup(4);
|
||||||
|
params[pnr++] = strdup("tempField");
|
||||||
|
params[pnr++] = intdup(5);
|
||||||
|
params[pnr++] = strdup("pressureField");
|
||||||
|
params[pnr++] = intdup(6);
|
||||||
|
params[pnr++] = strdup("units");
|
||||||
|
params[pnr++] = intdup(units);
|
||||||
|
params[pnr++] = NULL;
|
||||||
|
|
||||||
|
return parse_csv_file(file.c_str(), params, pnr - 1, "csv");
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestParse::exportCSVDiveProfile()
|
||||||
|
{
|
||||||
|
parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml");
|
||||||
|
|
||||||
|
export_dives_xslt("testcsvexportprofile.csv", 0, 0, "xml2csv.xslt");
|
||||||
|
export_dives_xslt("testcsvexportprofileimperial.csv", 0, 1, "xml2csv.xslt");
|
||||||
|
|
||||||
|
clear_dive_file_data();
|
||||||
|
|
||||||
|
parseCSVprofile(1, "testcsvexportprofileimperial.csv");
|
||||||
|
export_dives_xslt("testcsvexportprofile2.csv", 0, 0, "xml2csv.xslt");
|
||||||
|
|
||||||
|
FILE_COMPARE("testcsvexportprofile2.csv",
|
||||||
|
"testcsvexportprofile.csv");
|
||||||
|
|
||||||
|
clear_dive_file_data();
|
||||||
|
}
|
||||||
|
|
||||||
void TestParse::exportUDDF()
|
void TestParse::exportUDDF()
|
||||||
{
|
{
|
||||||
parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml");
|
parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml");
|
||||||
|
@ -390,6 +437,7 @@ void TestParse::exportUDDF()
|
||||||
void TestParse::testExport()
|
void TestParse::testExport()
|
||||||
{
|
{
|
||||||
exportCSVDiveDetails();
|
exportCSVDiveDetails();
|
||||||
|
exportCSVDiveProfile();
|
||||||
exportUDDF();
|
exportUDDF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ private slots:
|
||||||
|
|
||||||
int parseCSVmanual(int, std::string);
|
int parseCSVmanual(int, std::string);
|
||||||
void exportCSVDiveDetails();
|
void exportCSVDiveDetails();
|
||||||
|
int parseCSVprofile(int, std::string);
|
||||||
|
void exportCSVDiveProfile();
|
||||||
void exportUDDF();
|
void exportUDDF();
|
||||||
void testExport();
|
void testExport();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue