Skip to content

Commit

Permalink
Fixed tests from rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
amystamile-usgs committed Jan 27, 2025
1 parent 9346e66 commit b8037ec
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 62 deletions.
6 changes: 3 additions & 3 deletions isis/tests/FunctionalTestsDstripe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

using namespace Isis;

static QString APP_XML = FileName("$ISISROOT/bin/xml/dstripe.xml").expanded();
static QString APP_XML = QString::fromStdString(FileName("$ISISROOT/bin/xml/dstripe.xml").expanded());

TEST(Dstripe, FunctionalTestDstripeName) {
QTemporaryDir prefix;
Expand All @@ -27,7 +27,7 @@ TEST(Dstripe, FunctionalTestDstripeName) {
FAIL() << "Unable to open image: " << e.what() << std::endl;
}

Cube cube(outCubeFileName);
Cube cube(outCubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 99.405224835973755, .000001);
Expand All @@ -50,7 +50,7 @@ TEST(Dstripe, FunctionalTestDstripeParallel) {
FAIL() << "Unable to open image: " << e.what() << std::endl;
}

Cube cube(outCubeFileName);
Cube cube(outCubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 2.2391462548711162e-05, .000001);
Expand Down
6 changes: 3 additions & 3 deletions isis/tests/FunctionalTestsIsisImportChandrayaan2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ using namespace Isis;
using namespace testing;
using json = nlohmann::json;

static QString APP_XML = FileName("$ISISROOT/bin/xml/isisimport.xml").expanded();
static QString APP_XML = QString::fromStdString(FileName("$ISISROOT/bin/xml/isisimport.xml").expanded());

TEST_F(TempTestingFiles, FunctionalTestIsisImportChandrayaan2MinimalLabel){
std::istringstream PvlInput(R"(
Expand Down Expand Up @@ -150,7 +150,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportChandrayaan2MinimalLabel){
Pvl truthLabel;
PvlInput >> truthLabel;

Cube outCube(cubeFileName);
Cube outCube(cubeFileName.toStdString());
Pvl *outLabel = outCube.label();

PvlGroup truthGroup = truthLabel.findGroup("Dimensions", Pvl::Traverse);
Expand Down Expand Up @@ -313,7 +313,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportChandrayaan2FullLabel){
Pvl truthLabel;
PvlInput >> truthLabel;

Cube outCube(cubeFileName);
Cube outCube(cubeFileName.toStdString());
Pvl *outLabel = outCube.label();

PvlGroup truthGroup = truthLabel.findGroup("Dimensions", Pvl::Traverse);
Expand Down
2 changes: 1 addition & 1 deletion isis/tests/FunctionalTestsJigsaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@ TEST_F(ApolloNetwork, FunctionalTestJigsawSaveApplyValues) {
HighFive::DataSet datasetRead = file.getDataSet(cmatrixKey);
auto cmatrixData = datasetRead.read<std::string>();
Table cmatrixTable(cmatrixName, cmatrixData, ',');
std::string cmatrixTableStr = Table::toString(cmatrixTable).toStdString();
std::string cmatrixTableStr = Table::toString(cmatrixTable);

datasetRead = file.getDataSet(spvectorKey);
auto spvectorData = datasetRead.read<std::string>();
Expand Down
68 changes: 32 additions & 36 deletions isis/tests/FunctionalTestsNoseam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using namespace std;
using namespace Isis;

static QString APP_XML = FileName("$ISISROOT/bin/xml/noseam.xml").expanded();
static QString APP_XML = QString::fromStdString(FileName("$ISISROOT/bin/xml/noseam.xml").expanded());

/**
* NoseamDefault Test using ThreeImageNetwork Fixture
Expand All @@ -25,13 +25,13 @@ static QString APP_XML = FileName("$ISISROOT/bin/xml/noseam.xml").expanded();
TEST_F(ThreeImageNetwork, FunctionalTestNoseamDefault) {

// create list of input projected cube files
FileName cubeListFileName(tempDir.path() + "/cubes.lis");
FileName cubeListFileName(tempDir.path().toStdString() + "/cubes.lis");

ofstream of;
of.open((cubeListFileName.original()).toStdString());
of << cube1map->fileName() << "\n";
of << cube2map->fileName() << "\n";
of << cube3map->fileName() << "\n";
of.open((cubeListFileName.original()));
of << cube1map->fileName().toStdString() << "\n";
of << cube2map->fileName().toStdString() << "\n";
of << cube3map->fileName().toStdString() << "\n";
of.close();

// run noseam
Expand All @@ -46,11 +46,11 @@ TEST_F(ThreeImageNetwork, FunctionalTestNoseamDefault) {
noseam(cubeListFileName, ui);
}
catch (IException &e) {
FAIL() << e.toString().toStdString().c_str() << std::endl;
FAIL() << e.toString().c_str() << std::endl;
}

// validate output mosaic
Cube mosaic(tempDir.path() + "/noseamDefaultOut.cub");
Cube mosaic(tempDir.path().toStdString() + "/noseamDefaultOut.cub");

PvlObject mosaicLabel = mosaic.label()->findObject("IsisCube");
PvlGroup dimensions = mosaicLabel.findObject("Core").findGroup("Dimensions");
Expand Down Expand Up @@ -95,14 +95,14 @@ TEST_F(ThreeImageNetwork, FunctionalTestNoseamDefault) {
TEST_F(ThreeImageNetwork, FunctionalTestNoseamEvenBoxFilterSamples) {

// create list of input projected cube files
FileName cubeListFileName(tempDir.path() + "/cubes.lis");
FileName cubeListFileName(tempDir.path().toStdString() + "/cubes.lis");

// create list of input cube files
ofstream of;
of.open((cubeListFileName.original()).toStdString());
of << cube1map->fileName() << "\n";
of << cube2map->fileName() << "\n";
of << cube3map->fileName() << "\n";
of.open((cubeListFileName.original()));
of << cube1map->fileName().toStdString() << "\n";
of << cube2map->fileName().toStdString() << "\n";
of << cube3map->fileName().toStdString() << "\n";
of.close();

// run noseam
Expand All @@ -118,8 +118,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestNoseamEvenBoxFilterSamples) {
FAIL() << "Expected Exception for boxcar even sample input";
}
catch (IException &e) {
EXPECT_TRUE(e.toString().toLatin1().contains("[SAMPLES] must be odd"))
<< e.toString().toStdString();
EXPECT_TRUE(e.toString().find("[SAMPLES] must be odd") != std::string::npos);
}

// remove print.prt file if it has been created
Expand All @@ -146,14 +145,14 @@ TEST_F(ThreeImageNetwork, FunctionalTestNoseamEvenBoxFilterSamples) {
TEST_F(ThreeImageNetwork, FunctionalTestNoseamEvenBoxFilterLines) {

// create list of input projected cube files
FileName cubeListFileName(tempDir.path() + "/cubes.lis");
FileName cubeListFileName(tempDir.path().toStdString() + "/cubes.lis");

// create list of input cube files
ofstream of;
of.open((cubeListFileName.original()).toStdString());
of << cube1map->fileName() << "\n";
of << cube2map->fileName() << "\n";
of << cube3map->fileName() << "\n";
of.open((cubeListFileName.original()));
of << cube1map->fileName().toStdString() << "\n";
of << cube2map->fileName().toStdString() << "\n";
of << cube3map->fileName().toStdString() << "\n";
of.close();

// run noseam
Expand All @@ -169,8 +168,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestNoseamEvenBoxFilterLines) {
FAIL() << "Expected Exception for boxcar even line input";
}
catch (IException &e) {
EXPECT_TRUE(e.toString().toLatin1().contains("[LINES] must be odd"))
<< e.toString().toStdString();
EXPECT_TRUE(e.toString().find("[LINES] must be odd") != std::string::npos);
}

// remove print.prt file if it has been created
Expand All @@ -196,14 +194,14 @@ TEST_F(ThreeImageNetwork, FunctionalTestNoseamEvenBoxFilterLines) {
TEST_F(ThreeImageNetwork, FunctionalTestNoseamNoBoxFilterSamples) {

// create list of input projected cube files
FileName cubeListFileName(tempDir.path() + "/cubes.lis");
FileName cubeListFileName(tempDir.path().toStdString() + "/cubes.lis");

// create list of input cube files
ofstream of;
of.open((cubeListFileName.original()).toStdString());
of << cube1map->fileName() << "\n";
of << cube2map->fileName() << "\n";
of << cube3map->fileName() << "\n";
of.open((cubeListFileName.original()));
of << cube1map->fileName().toStdString() << "\n";
of << cube2map->fileName().toStdString() << "\n";
of << cube3map->fileName().toStdString() << "\n";
of.close();

// run noseam
Expand All @@ -218,8 +216,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestNoseamNoBoxFilterSamples) {
FAIL() << "Expected Exception for no input for boxcar samples";
}
catch (IException &e) {
EXPECT_TRUE(e.toString().toLatin1().contains("[SAMPLES] must be entered"))
<< e.toString().toStdString();
EXPECT_TRUE(e.toString().find("[SAMPLES] must be entered") != std::string::npos);
}

// remove print.prt file if it has been created
Expand All @@ -245,14 +242,14 @@ TEST_F(ThreeImageNetwork, FunctionalTestNoseamNoBoxFilterSamples) {
TEST_F(ThreeImageNetwork, FunctionalTestNoseamNoBoxFilterLines) {

// create list of input projected cube files
FileName cubeListFileName(tempDir.path() + "/cubes.lis");
FileName cubeListFileName(tempDir.path().toStdString() + "/cubes.lis");

// create list of input cube files
ofstream of;
of.open((cubeListFileName.original()).toStdString());
of << cube1map->fileName() << "\n";
of << cube2map->fileName() << "\n";
of << cube3map->fileName() << "\n";
of.open((cubeListFileName.original()));
of << cube1map->fileName().toStdString() << "\n";
of << cube2map->fileName().toStdString() << "\n";
of << cube3map->fileName().toStdString() << "\n";
of.close();

// run noseam
Expand All @@ -267,8 +264,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestNoseamNoBoxFilterLines) {
FAIL() << "Expected Exception for no input for boxcar lines";
}
catch (IException &e) {
EXPECT_TRUE(e.toString().toLatin1().contains("[LINES] must be entered"))
<< e.toString().toStdString();
EXPECT_TRUE(e.toString().find("[LINES] must be entered") != std::string::npos);
}

// determine if print.prt has been generated and if so, remove it
Expand Down
32 changes: 16 additions & 16 deletions isis/tests/FunctionalTestsPhotomet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

using namespace Isis;

static QString APP_XML = FileName("$ISISROOT/bin/xml/photomet.xml").expanded();
static QString APP_XML = QString::fromStdString(FileName("$ISISROOT/bin/xml/photomet.xml").expanded());

TEST(Photomet, FunctionalTestPhotometClementine) {
QTemporaryDir prefix;
Expand All @@ -23,7 +23,7 @@ TEST(Photomet, FunctionalTestPhotometClementine) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 57.865063346038504, .000001);
Expand All @@ -43,7 +43,7 @@ TEST(Photomet, FunctionalTestPhotometClemMaxemiMaxinc) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 55.491706688909559, .000001);
Expand All @@ -64,7 +64,7 @@ TEST(Photomet, FunctionalTestPhotometClemMaxemission) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 58.134963167604397, .000001);
Expand All @@ -86,7 +86,7 @@ TEST(Photomet, FunctionalTestPhotometMessCmdline) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 0.05943594115596508, .000001);
Expand All @@ -106,7 +106,7 @@ TEST(Photomet, FunctionalTestPhotometMessenger) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 0.12118244647528577, .000001);
Expand All @@ -127,7 +127,7 @@ TEST(Photomet, FunctionalTestPhotometMessMaxemiMaxinc) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), -1.7976931348623149e+308, .000001);
Expand All @@ -148,7 +148,7 @@ TEST(Photomet, FunctionalTestPhotometMessMaxemission) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 0.12118244647528577, .000001);
Expand All @@ -169,7 +169,7 @@ TEST(Photomet, FunctionalTestPhotometMessMaxincidence) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), -1.7976931348623149e+308, .000001);
Expand All @@ -193,7 +193,7 @@ TEST(Photomet, FunctionalTestPhotometMessBackplane) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), -1.7976931348623149e+308, .000001);
Expand All @@ -215,7 +215,7 @@ TEST(Photomet, FunctionalTestPhotometTestDemWarningMixed) {
photomet(options, &log);

PvlGroup warning = log.findGroup("Warnings");
EXPECT_PRED_FORMAT2(AssertQStringsEqual, warning["Warning"], "The MIXED Normalized model is not recommended for use with the DEM Angle Source option");
EXPECT_PRED_FORMAT2(AssertStringsEqual, warning["Warning"], "The MIXED Normalized model is not recommended for use with the DEM Angle Source option");
}

TEST(Photomet, FunctionalTestPhotometTestDemWarningTopo) {
Expand All @@ -231,7 +231,7 @@ TEST(Photomet, FunctionalTestPhotometTestDemWarningTopo) {
photomet(options, &log);

PvlGroup warning = log.findGroup("Warnings");
EXPECT_PRED_FORMAT2(AssertQStringsEqual, warning["Warning"], "The TOPO Normalized model is not recommended for use with the DEM Angle Source option");
EXPECT_PRED_FORMAT2(AssertStringsEqual, warning["Warning"], "The TOPO Normalized model is not recommended for use with the DEM Angle Source option");
}

TEST(Photomet, FunctionalTestPhotometTestAngleSourceDemUseDemFalse) {
Expand All @@ -246,7 +246,7 @@ TEST(Photomet, FunctionalTestPhotometTestAngleSourceDemUseDemFalse) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 14792.765466992187, .000001);
Expand All @@ -266,7 +266,7 @@ TEST(Photomet, FunctionalTestPhotometTestAngleSourceEllipsoidUseDemFalse) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 14749.07615234375, .000001);
Expand All @@ -286,7 +286,7 @@ TEST(Photomet, FunctionalTestPhotometTestAngleSourceEllipsoidUseDemTrue) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 14749.07615234375, .000001);
Expand All @@ -306,7 +306,7 @@ TEST(Photomet, FunctionalTestPhotometTestAngleSourceDemUseDemTrue) {

photomet(options, &log);

Cube cube(cubeFileName);
Cube cube(cubeFileName.toStdString());

std::unique_ptr<Histogram> hist (cube.histogram(0));
EXPECT_NEAR(hist->Average(), 14792.765466992187, .000001);
Expand Down
6 changes: 3 additions & 3 deletions isis/tests/FunctionalTestsPixel2map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

using namespace Isis;

static QString PIXEL2MAP_XML = FileName("$ISISROOT/bin/xml/pixel2map.xml").expanded();
static QString PIXEL2MAP_XML = QString::fromStdString(FileName("$ISISROOT/bin/xml/pixel2map.xml").expanded());

TEST_F(MroCtxCube, FunctionalTestPixel2mapVector) {

Expand Down Expand Up @@ -50,9 +50,9 @@ TEST_F(MroCtxCube, FunctionalTestPixel2mapVector) {


// TEST 1a: Check we have both csv and vrt output files
FileName csvFileOut( csvFileName );
FileName csvFileOut( csvFileName.toStdString() );
EXPECT_TRUE(csvFileOut.fileExists());
FileName vrtFileOut( vrtFileName );
FileName vrtFileOut( vrtFileName.toStdString() );
EXPECT_TRUE(vrtFileOut.fileExists());

// TEST 1b: Check the output csv file header
Expand Down

0 comments on commit b8037ec

Please sign in to comment.