Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added error tests for jigsaw #4093

Merged
merged 6 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions isis/src/control/apps/jigsaw/jigsaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ namespace Isis {
QString cubeList = ui.GetFileName("FROMLIST");

// retrieve settings from jigsaw gui

BundleSettingsQsp settings = bundleSettings(ui);
settings->setCubeList(cubeList);
BundleAdjust *bundleAdjustment = NULL;
Expand All @@ -73,7 +72,6 @@ namespace Isis {
throw;
}


// Bundle adjust the network
try {

Expand Down Expand Up @@ -103,7 +101,6 @@ namespace Isis {
bundleAdjustment->controlNet()->Write(ui.GetFileName("ONET"));

PvlGroup gp("JigsawResults");

// Update the cube pointing if requested but ONLY if bundle has converged
if (ui.GetBoolean("UPDATE") ) {
if ( !bundleAdjustment->isConverged() ) {
Expand Down
78 changes: 0 additions & 78 deletions isis/src/control/apps/jigsaw/tsts/errors/Makefile

This file was deleted.

84 changes: 80 additions & 4 deletions isis/tests/FunctionalTestsJigsaw.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#include "Fixtures.h"
#include "Pvl.h"
#include "PvlGroup.h"
#include "TestUtilities.h"
#include "ControlNet.h"
#include "Statistics.h"

#include "jigsaw.h"

#include "gtest/gtest.h"
#include "TestUtilities.h"
#include "Fixtures.h"
#include "gmock/gmock.h"

using namespace Isis;
using namespace testing;


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

Expand Down Expand Up @@ -143,4 +145,78 @@ TEST_F(ObservationPair, FunctionalTestJigsawCamSolveAll) {
// DEC(t3) final
EXPECT_NEAR(elems.at(56).toDouble(), 0.365717165, 0.00001);

}
}

TEST_F(ObservationPair, FunctionalTestJigsawErrorNoSolve) {
QTemporaryDir prefix;
QString outCnetFileName = prefix.path() + "/outTemp.net";
QVector<QString> args = {"fromlist="+cubeListFile, "cnet="+cnetPath, "onet="+outCnetFileName,
"camsolve=None", "spsolve=None"};

UserInterface options(APP_XML, args);

Pvl log;

try {
jigsaw(options, &log);
FAIL() << "Should throw" << std::endl;
}
catch (IException &e) {
EXPECT_THAT(e.what(), HasSubstr("Must either solve for camera pointing or spacecraft position"));
}
}


TEST_F(ObservationPair, FunctionalTestJigsawErrorTBParamsNoTarget) {
QTemporaryDir prefix;
QString outCnetFileName = prefix.path() + "/outTemp.net";

// just use isdPath for a valid PVL file without the wanted groups
QVector<QString> args = {"fromlist="+cubeListFile, "cnet="+cnetPath, "onet="+outCnetFileName, "SOLVETARGETBODY=TRUE", "tbparameters="+cubeRPath};

UserInterface options(APP_XML, args);

Pvl log;

try {
jigsaw(options, &log);
FAIL() << "Should throw an exception" << std::endl;
}
catch (IException &e) {
EXPECT_THAT(e.what(), HasSubstr("Input Target parameters file missing main Target object"));
}
}


TEST_F(ObservationPair, FunctionalTestJigsawErrorTBParamsNoSolve) {
QTemporaryDir prefix;
QString outCnetFileName = prefix.path() + "/outTemp.net";

std::istringstream iss(R"(
Object = Target
Group = "NAME"
Name=Enceladus
EndGroup
END_OBJECT
)");

QString tbsolvepath = prefix.path() + "/tbsolve.pvl";
Pvl tbsolve;
iss >> tbsolve;
tbsolve.write(tbsolvepath);

// just use isdPath for a valid PVL file without the wanted groups
QVector<QString> args = {"fromlist="+cubeListFile, "cnet="+cnetPath, "onet="+outCnetFileName, "SOLVETARGETBODY=TRUE", "tbparameters="+tbsolvepath};

UserInterface options(APP_XML, args);

Pvl log;

try {
jigsaw(options, &log);
FAIL() << "Should throw an exception" << std::endl;
}
catch (IException &e) {
EXPECT_THAT(e.what(), HasSubstr("Must solve for at least one target body option"));
}
}