Skip to content

Commit

Permalink
Add test data and increase code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerfraser committed May 1, 2021
1 parent 0937be8 commit 3208811
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dynadjust/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ if (BUILD_TESTING)
add_test (NAME geo-ntv2-export-04 COMMAND $<TARGET_FILE:dnageoidwrapper> -g ./gnss-network-geoid.gsb.asc --export-ntv2-gsb --grid-shift-type radians)
add_test (NAME imp-outside COMMAND $<TARGET_FILE:dnaimportwrapper> -n outside ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr)
add_test (NAME geo-outside-01 COMMAND $<TARGET_FILE:dnageoidwrapper> outside -g ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network-geoid.gsb --convert --verbose 1)
add_test (NAME geo-outside-02 COMMAND $<TARGET_FILE:dnageoidwrapper> outside -g ./gnss-network-geoid.gsb.asc --convert --verbose 1)
add_test (NAME geo-outside-02 COMMAND $<TARGET_FILE:dnageoidwrapper> outside -g ./gnss-network-geoid.gsb.asc --convert --verbose 2)
add_test (NAME geo-inside-01 COMMAND $<TARGET_FILE:dnageoidwrapper> gnss -g ./gnss-network-geoid.gsb.asc --convert --export-dna-geo)
add_test (NAME geo-inside-02 COMMAND $<TARGET_FILE:dnageoidwrapper> -g ./gnss-network-geoid.gsb.asc -t ${CMAKE_SOURCE_DIR}/../sampleData/geoid-points-dat.txt)
add_test (NAME geo-inside-03 COMMAND $<TARGET_FILE:dnageoidwrapper> -g ./gnss-network-geoid.gsb.asc -t ${CMAKE_SOURCE_DIR}/../sampleData/geoid-points-dat.txt --interpolation-method 0)

# bash command to check results
#add_test (NAME test-urban-phased-network COMMAND bash -c "diff <(tail -n +62 urban.phased.adj) <(tail -n +62 ${CMAKE_SOURCE_DIR}/../sampleData/urban.phased.adj.expected)")
Expand Down
20 changes: 19 additions & 1 deletion dynadjust/dynadjust/dnageoidwrapper/dnageoidwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ bool ExportNTv2GridToBinary(dna_geoid_interpolation* g, const char* dat_gridfile
void ReturnBadStationRecords(dna_geoid_interpolation* g, project_settings& p)
{
string records, filename(p.g.network_name);
string badpointsPath(formPath<string>(p.g.output_folder, filename, "gil"));
string badpointsPath(formPath<string>(p.g.output_folder, filename, "int"));
stringstream ss;
std::ofstream badpoints_log;

Expand Down Expand Up @@ -162,6 +162,24 @@ void ReturnBadStationRecords(dna_geoid_interpolation* g, project_settings& p)

badpoints_log << records << endl;

if (p.g.verbose > 1)
{
string data("<file record or filename>");
badpoints_log << endl << endl <<
"DYNADJUST GEOID INTERPOLARION ERROR CODES" << endl << endl <<
setw(PAD) << "Code" << "Description (short and long)" << endl <<
"------------------------------------------------------" << endl;
for (int i=ERR_AUS_BINARY; i<=ERR_INTERPOLATION_TYPE; ++i)
{
badpoints_log <<
setw(PAD) << i <<
setw(ZONE) << "Short: " << g->ErrorCaption(i) << endl <<
setw(PAD) << " " <<
setw(ZONE) << "Long: " << g->ErrorString(i, data) << endl;
}
}


badpoints_log.close();

cout << endl << " See " << badpointsPath << " to view the list of stations for which an" << endl <<
Expand Down
4 changes: 4 additions & 0 deletions sampleData/geoid-points-dat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ e -37.610172924 -144.213914283 Outside the grid limits
220700210 -36.5740496878 145.4736891210 332.233 BORODOMANIN PM 21
222000390 -36.4508400411 145.3332108846 171.931 BRANJEE PM 39
222701160 -36.4342838852 146.5807975413 311.928 BRIGHT PM 116
f -37.3000000000 147.3000000000 100.000 South east grid limit
g -36.0000000000 147.3000000000 200.000 North east grid limit
h -36.0000000000 145.0000000000 300.000 North west grid limit
i -37.3000000000 145.0000000000 400.000 South west grid limit

0 comments on commit 3208811

Please sign in to comment.