Loading isis/tests/CamptFunctionalTests.cpp +12 −15 Original line number Diff line number Diff line #include <QTemporaryFile> #include <QTextStream> #include <QStringList> #include <QFile> #include "campt.h" #include "Fixtures.h" Loading @@ -17,14 +17,13 @@ static QString APP_XML = FileName("$ISISROOT/bin/xml/campt.xml").expanded(); TEST_F(DefaultCube, FunctionalTestCamptBadColumnError) { // set up bad coordinates file std::ofstream of; QTemporaryFile badList; ASSERT_TRUE(badList.open()); of.open(badList.fileName().toStdString()); of.open(tempDir.path().toStdString()+"/badList.lis"); of << "1, 10,\n10,100,500\n100"; of.close(); // configure UserInterface arguments QVector<QString> args = {"to=output.pvl", "coordlist=" + badList.fileName(), QVector<QString> args = {"to=" + tempDir.path()+"/output.pvl", "coordlist=" + tempDir.path()+"/badList.lis", "coordtype=image"}; UserInterface options(APP_XML, args); Pvl appLog; Loading Loading @@ -191,11 +190,10 @@ TEST_F(DefaultCube, FunctionalTestCamptSetGround) { TEST_F(DefaultCube, FunctionalTestCamptFlat) { // Setup output file QTemporaryFile flatFile; flatFile.open(); QVector<QString> args = {"format=flat", "to=" + flatFile.fileName(), "append=false"}; QFile flatFile(tempDir.path()+"/testOut.txt"); QVector<QString> args = {"format=flat", "to="+flatFile.fileName(), "append=false"}; UserInterface options(APP_XML, args); Pvl appLog; Loading @@ -221,14 +219,13 @@ TEST_F(DefaultCube, FunctionalTestCamptFlat) { TEST_F(DefaultCube, FunctionalTestCamptCoordList) { std::ofstream of; QTemporaryFile badPointList; ASSERT_TRUE(badPointList.open()); of.open(badPointList.fileName().toStdString()); of.open(tempDir.path().toStdString()+"/coords.txt"); of << "1, 10\n10, 100\n 100, 10000"; of.close(); QVector<QString> args = {"coordlist=" + badPointList.fileName(), "append=false", "coordtype=image"}; QVector<QString> args = {"coordlist="+tempDir.path()+"/coords.txt", "append=false", "coordtype=image"}; UserInterface options(APP_XML, args); Pvl appLog; Loading isis/tests/CnetWinnowTests.cpp +2 −6 Original line number Diff line number Diff line #include <iostream> #include <QTemporaryDir> #include "cnetwinnow.h" Loading @@ -20,10 +19,7 @@ using namespace Isis; static QString APP_XML = FileName("$ISISROOT/bin/xml/cnetwinnow.xml").expanded(); TEST_F(ThreeImageNetwork, FunctionalTestCnetwinnowDefault) { QTemporaryDir prefix; ASSERT_TRUE(prefix.isValid()); QString onetPath = prefix.path()+"/winnowedNetwork.net"; QString onetPath = tempDir.path()+"/winnowedNetwork.net"; QVector<QString> args = {"onet="+onetPath, "file_prefix=winnow"}; UserInterface ui(APP_XML, args); Loading @@ -44,7 +40,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestCnetwinnowDefault) { } } SerialNumberList serialNumList(cubeListTempPath.fileName(), true); SerialNumberList serialNumList(cubeListFile, true); cnetwinnow(*network, serialNumList, ui); int postWinnowMeasureCount = network->GetNumValidMeasures(); Loading isis/tests/Fixtures.cpp +19 −12 Original line number Diff line number Diff line Loading @@ -2,14 +2,21 @@ namespace Isis { void TempTestingFiles::SetUp() { ASSERT_TRUE(tempDir.isValid()); } void DefaultCube::SetUp() { TempTestingFiles::SetUp(); std::ifstream isdFile("data/defaultImage/defaultCube.isd"); std::ifstream cubeLabel("data/defaultImage/defaultCube.pvl"); isdFile >> isd; cubeLabel >> label; testCube = new Cube(); testCube->fromIsd(tempFile.fileName() + ".cub", label, isd, "rw"); testCube->fromIsd(tempDir.path() + "/default.cub", label, isd, "rw"); } Loading @@ -17,10 +24,13 @@ namespace Isis { if (testCube->isOpen()) { testCube->close(); } delete testCube; } void ThreeImageNetwork::SetUp() { TempTestingFiles::SetUp(); FileName labelPath1("data/threeImageNetwork/cube1.pvl"); FileName labelPath2("data/threeImageNetwork/cube2.pvl"); FileName labelPath3("data/threeImageNetwork/cube3.pvl"); Loading @@ -30,24 +40,21 @@ namespace Isis { FileName isdPath3("data/threeImageNetwork/cube3.isd"); cube1 = new Cube(); cubeTempPath1.open(); cube1->fromIsd(cubeTempPath1.fileName() + ".cub", labelPath1, isdPath1, "rw"); cube1->fromIsd(tempDir.path() + "/cube1.cub", labelPath1, isdPath1, "rw"); cube2 = new Cube(); cubeTempPath2.open(); cube2->fromIsd(cubeTempPath2.fileName() + ".cub", labelPath2, isdPath2, "rw"); cube2->fromIsd(tempDir.path() + "/cube2.cub", labelPath2, isdPath2, "rw"); cube3 = new Cube(); cubeTempPath3.open(); cube3->fromIsd(cubeTempPath3.fileName() + ".cub", labelPath3, isdPath3, "rw"); cube3->fromIsd(tempDir.path() + "/cube3.cub", labelPath3, isdPath3, "rw"); cubeList = new FileList(); cubeList->append(cube1->fileName()); cubeList->append(cube2->fileName()); cubeList->append(cube3->fileName()); cubeListTempPath.open(); cubeList->write(cubeListTempPath.fileName()); cubeListFile = tempDir.path() + "/cubes.lis"; cubeList->write(cubeListFile); network = new ControlNet(); network->ReadControl("data/threeImageNetwork/controlnetwork.net"); Loading isis/tests/Fixtures.h +29 −26 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ #include <string> #include <QString> #include <QTemporaryFile> #include <QTemporaryDir> #include <nlohmann/json.hpp> Loading @@ -23,10 +23,17 @@ using json = nlohmann::json; namespace Isis { class DefaultCube : public ::testing::Test { class TempTestingFiles : public ::testing::Test { protected: QTemporaryDir tempDir; void SetUp() override; }; class DefaultCube : public TempTestingFiles { protected: Cube *testCube; QTemporaryFile tempFile; Pvl label; json isd; Loading @@ -36,7 +43,7 @@ namespace Isis { }; class ThreeImageNetwork : public ::testing::Test { class ThreeImageNetwork : public TempTestingFiles { protected: ControlNet *network; Loading @@ -46,11 +53,7 @@ namespace Isis { Cube *cube3; FileList *cubeList; QTemporaryFile cubeTempPath1; QTemporaryFile cubeTempPath2; QTemporaryFile cubeTempPath3; QTemporaryFile cubeListTempPath; QString cubeListFile; void SetUp() override; void TearDown() override; Loading isis/tests/cnetbin2pvlTests.cpp +1 −5 Original line number Diff line number Diff line #include <QTemporaryDir> #include <iostream> #include "Pvl.h" Loading @@ -14,10 +13,7 @@ using namespace Isis; static QString APP_XML = FileName("$ISISROOT/bin/xml/cnetbin2pvl.xml").expanded(); TEST_F(ThreeImageNetwork, FunctionalTestCnetbin2pvlDefault) { QTemporaryDir prefix; ASSERT_TRUE(prefix.isValid()); QString pvlOut = prefix.path()+"/cnetbin2pvlNetwork.pvl"; QString pvlOut = tempDir.path()+"/cnetbin2pvlNetwork.pvl"; QVector<QString> args = {"to="+pvlOut}; UserInterface ui(APP_XML, args); Loading Loading
isis/tests/CamptFunctionalTests.cpp +12 −15 Original line number Diff line number Diff line #include <QTemporaryFile> #include <QTextStream> #include <QStringList> #include <QFile> #include "campt.h" #include "Fixtures.h" Loading @@ -17,14 +17,13 @@ static QString APP_XML = FileName("$ISISROOT/bin/xml/campt.xml").expanded(); TEST_F(DefaultCube, FunctionalTestCamptBadColumnError) { // set up bad coordinates file std::ofstream of; QTemporaryFile badList; ASSERT_TRUE(badList.open()); of.open(badList.fileName().toStdString()); of.open(tempDir.path().toStdString()+"/badList.lis"); of << "1, 10,\n10,100,500\n100"; of.close(); // configure UserInterface arguments QVector<QString> args = {"to=output.pvl", "coordlist=" + badList.fileName(), QVector<QString> args = {"to=" + tempDir.path()+"/output.pvl", "coordlist=" + tempDir.path()+"/badList.lis", "coordtype=image"}; UserInterface options(APP_XML, args); Pvl appLog; Loading Loading @@ -191,11 +190,10 @@ TEST_F(DefaultCube, FunctionalTestCamptSetGround) { TEST_F(DefaultCube, FunctionalTestCamptFlat) { // Setup output file QTemporaryFile flatFile; flatFile.open(); QVector<QString> args = {"format=flat", "to=" + flatFile.fileName(), "append=false"}; QFile flatFile(tempDir.path()+"/testOut.txt"); QVector<QString> args = {"format=flat", "to="+flatFile.fileName(), "append=false"}; UserInterface options(APP_XML, args); Pvl appLog; Loading @@ -221,14 +219,13 @@ TEST_F(DefaultCube, FunctionalTestCamptFlat) { TEST_F(DefaultCube, FunctionalTestCamptCoordList) { std::ofstream of; QTemporaryFile badPointList; ASSERT_TRUE(badPointList.open()); of.open(badPointList.fileName().toStdString()); of.open(tempDir.path().toStdString()+"/coords.txt"); of << "1, 10\n10, 100\n 100, 10000"; of.close(); QVector<QString> args = {"coordlist=" + badPointList.fileName(), "append=false", "coordtype=image"}; QVector<QString> args = {"coordlist="+tempDir.path()+"/coords.txt", "append=false", "coordtype=image"}; UserInterface options(APP_XML, args); Pvl appLog; Loading
isis/tests/CnetWinnowTests.cpp +2 −6 Original line number Diff line number Diff line #include <iostream> #include <QTemporaryDir> #include "cnetwinnow.h" Loading @@ -20,10 +19,7 @@ using namespace Isis; static QString APP_XML = FileName("$ISISROOT/bin/xml/cnetwinnow.xml").expanded(); TEST_F(ThreeImageNetwork, FunctionalTestCnetwinnowDefault) { QTemporaryDir prefix; ASSERT_TRUE(prefix.isValid()); QString onetPath = prefix.path()+"/winnowedNetwork.net"; QString onetPath = tempDir.path()+"/winnowedNetwork.net"; QVector<QString> args = {"onet="+onetPath, "file_prefix=winnow"}; UserInterface ui(APP_XML, args); Loading @@ -44,7 +40,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestCnetwinnowDefault) { } } SerialNumberList serialNumList(cubeListTempPath.fileName(), true); SerialNumberList serialNumList(cubeListFile, true); cnetwinnow(*network, serialNumList, ui); int postWinnowMeasureCount = network->GetNumValidMeasures(); Loading
isis/tests/Fixtures.cpp +19 −12 Original line number Diff line number Diff line Loading @@ -2,14 +2,21 @@ namespace Isis { void TempTestingFiles::SetUp() { ASSERT_TRUE(tempDir.isValid()); } void DefaultCube::SetUp() { TempTestingFiles::SetUp(); std::ifstream isdFile("data/defaultImage/defaultCube.isd"); std::ifstream cubeLabel("data/defaultImage/defaultCube.pvl"); isdFile >> isd; cubeLabel >> label; testCube = new Cube(); testCube->fromIsd(tempFile.fileName() + ".cub", label, isd, "rw"); testCube->fromIsd(tempDir.path() + "/default.cub", label, isd, "rw"); } Loading @@ -17,10 +24,13 @@ namespace Isis { if (testCube->isOpen()) { testCube->close(); } delete testCube; } void ThreeImageNetwork::SetUp() { TempTestingFiles::SetUp(); FileName labelPath1("data/threeImageNetwork/cube1.pvl"); FileName labelPath2("data/threeImageNetwork/cube2.pvl"); FileName labelPath3("data/threeImageNetwork/cube3.pvl"); Loading @@ -30,24 +40,21 @@ namespace Isis { FileName isdPath3("data/threeImageNetwork/cube3.isd"); cube1 = new Cube(); cubeTempPath1.open(); cube1->fromIsd(cubeTempPath1.fileName() + ".cub", labelPath1, isdPath1, "rw"); cube1->fromIsd(tempDir.path() + "/cube1.cub", labelPath1, isdPath1, "rw"); cube2 = new Cube(); cubeTempPath2.open(); cube2->fromIsd(cubeTempPath2.fileName() + ".cub", labelPath2, isdPath2, "rw"); cube2->fromIsd(tempDir.path() + "/cube2.cub", labelPath2, isdPath2, "rw"); cube3 = new Cube(); cubeTempPath3.open(); cube3->fromIsd(cubeTempPath3.fileName() + ".cub", labelPath3, isdPath3, "rw"); cube3->fromIsd(tempDir.path() + "/cube3.cub", labelPath3, isdPath3, "rw"); cubeList = new FileList(); cubeList->append(cube1->fileName()); cubeList->append(cube2->fileName()); cubeList->append(cube3->fileName()); cubeListTempPath.open(); cubeList->write(cubeListTempPath.fileName()); cubeListFile = tempDir.path() + "/cubes.lis"; cubeList->write(cubeListFile); network = new ControlNet(); network->ReadControl("data/threeImageNetwork/controlnetwork.net"); Loading
isis/tests/Fixtures.h +29 −26 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ #include <string> #include <QString> #include <QTemporaryFile> #include <QTemporaryDir> #include <nlohmann/json.hpp> Loading @@ -23,10 +23,17 @@ using json = nlohmann::json; namespace Isis { class DefaultCube : public ::testing::Test { class TempTestingFiles : public ::testing::Test { protected: QTemporaryDir tempDir; void SetUp() override; }; class DefaultCube : public TempTestingFiles { protected: Cube *testCube; QTemporaryFile tempFile; Pvl label; json isd; Loading @@ -36,7 +43,7 @@ namespace Isis { }; class ThreeImageNetwork : public ::testing::Test { class ThreeImageNetwork : public TempTestingFiles { protected: ControlNet *network; Loading @@ -46,11 +53,7 @@ namespace Isis { Cube *cube3; FileList *cubeList; QTemporaryFile cubeTempPath1; QTemporaryFile cubeTempPath2; QTemporaryFile cubeTempPath3; QTemporaryFile cubeListTempPath; QString cubeListFile; void SetUp() override; void TearDown() override; Loading
isis/tests/cnetbin2pvlTests.cpp +1 −5 Original line number Diff line number Diff line #include <QTemporaryDir> #include <iostream> #include "Pvl.h" Loading @@ -14,10 +13,7 @@ using namespace Isis; static QString APP_XML = FileName("$ISISROOT/bin/xml/cnetbin2pvl.xml").expanded(); TEST_F(ThreeImageNetwork, FunctionalTestCnetbin2pvlDefault) { QTemporaryDir prefix; ASSERT_TRUE(prefix.isValid()); QString pvlOut = prefix.path()+"/cnetbin2pvlNetwork.pvl"; QString pvlOut = tempDir.path()+"/cnetbin2pvlNetwork.pvl"; QVector<QString> args = {"to="+pvlOut}; UserInterface ui(APP_XML, args); Loading