Skip to content

Commit

Permalink
Add unit test for new Image reuse functionality
Browse files Browse the repository at this point in the history
The test is simple, but at demonstrates that reusing an Image object
yields the same result over and over. Also the fact that it actually
runs is also encouraging.

Signed-off-by: Rodrigo Tobar <[email protected]>
  • Loading branch information
rtobar committed Jul 10, 2024
1 parent ae10b62 commit e08bed4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/profit/tests/test_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,23 @@ class TestModel : public CxxTest::TestSuite {
_test_no_crop({20, 20}, 2, ConvolverType::FFT);
}

void test_reuse_image()
{
Model m{100, 100};
auto sky_profile = m.add_profile("sky");
sky_profile->parameter("bg", 1.);

// after evaluation the image should have a value
Image image{m.get_drawing_dimensions()};
TS_ASSERT_EQUALS(image[0], 0.);
m.evaluate(image);
TS_ASSERT_EQUALS(image[0], 1.);

// we can evaluate again, the result should be the same
m.evaluate(image);
TS_ASSERT_EQUALS(image[0], 1.);
}

};

class TestMaskAdjustments : public CxxTest::TestSuite {
Expand Down

0 comments on commit e08bed4

Please sign in to comment.