MCPcopy Create free account
hub / github.com/DOI-USGS/ISIS3 / TEST_F

Function TEST_F

isis/tests/FunctionalTestsExplode.cpp:29–79  ·  view source on GitHub ↗

* ExplodeDefault Test * * ExplodeDefault test given a single 5x5 input cube with 2 bands. * * The output cube is verified by checking the histogram statistics * for each band. * * INPUT: testCube from DefaultCube fixture resized to 5x5x1 * * OUTPUT: 1) explodeOut.band0001.cub * 2) explodeOut.band0002.cub */

Source from the content-addressed store, hash-verified

27 * 2) explodeOut.band0002.cub
28 */
29TEST_F(DefaultCube, FunctionalTestExplodeDefault) {
30
31 // reduce test cube size and create two bands
32 resizeCube(5, 5, 2);
33
34 // close and reopen test cube to ensure dn buffer is available
35 testCube->reopen("r");
36
37 // run explode
38 QVector<QString> args = {"to=" + tempDir.path() + "/explodeOut"};
39 UserInterface ui(APP_XML, args);
40
41 try {
42 explode(testCube, ui);
43 }
44 catch(IException &e) {
45 FAIL() << e.toString().toStdString().c_str() << std::endl;
46 }
47
48 // validate band 1 output cube
49 Cube outCube1(tempDir.path() + "/explodeOut.band0001.cub");
50
51 ASSERT_EQ(outCube1.sampleCount(), 5);
52 ASSERT_EQ(outCube1.lineCount(), 5);
53 ASSERT_EQ(outCube1.bandCount(), 1);
54
55 std::unique_ptr<Histogram> inCubeBand1Hist (testCube->histogram(1));
56 std::unique_ptr<Histogram> outCube1Hist (outCube1.histogram(1));
57
58 EXPECT_NEAR(outCube1Hist->Average(), inCubeBand1Hist->Average(), .000001);
59 EXPECT_NEAR(outCube1Hist->Sum(), inCubeBand1Hist->Sum(), .000001);
60 EXPECT_EQ(outCube1Hist->ValidPixels(), inCubeBand1Hist->ValidPixels());
61 EXPECT_EQ(outCube1Hist->TotalPixels(), inCubeBand1Hist->TotalPixels());
62 EXPECT_NEAR(outCube1Hist->StandardDeviation(), inCubeBand1Hist->StandardDeviation(), .000001);
63
64 // validate band 2 output cube
65 Cube outCube2(tempDir.path() + "/explodeOut.band0002.cub");
66
67 ASSERT_EQ(outCube2.sampleCount(), 5);
68 ASSERT_EQ(outCube2.lineCount(), 5);
69 ASSERT_EQ(outCube2.bandCount(), 1);
70
71 std::unique_ptr<Histogram> inCubeBand2Hist (testCube->histogram(2));
72 std::unique_ptr<Histogram> outCube2Hist (outCube2.histogram(1));
73
74 EXPECT_NEAR(outCube2Hist->Average(), inCubeBand2Hist->Average(), .000001);
75 EXPECT_NEAR(outCube2Hist->Sum(), inCubeBand2Hist->Sum(), .000001);
76 EXPECT_EQ(outCube2Hist->ValidPixels(), inCubeBand2Hist->ValidPixels());
77 EXPECT_EQ(outCube2Hist->TotalPixels(), inCubeBand2Hist->TotalPixels());
78 EXPECT_NEAR(outCube2Hist->StandardDeviation(), inCubeBand2Hist->StandardDeviation(), .000001);
79}
80

Callers

nothing calls this directly

Calls 13

explodeFunction · 0.85
reopenMethod · 0.80
histogramMethod · 0.80
SumMethod · 0.80
pathMethod · 0.45
toStringMethod · 0.45
sampleCountMethod · 0.45
lineCountMethod · 0.45
bandCountMethod · 0.45
AverageMethod · 0.45
ValidPixelsMethod · 0.45
TotalPixelsMethod · 0.45

Tested by

no test coverage detected