Skip to content

Commit

Permalink
Update regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sz3 committed Jun 1, 2023
1 parent 8c891d0 commit d452652
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/lib/cimb_translator/test/CimbReaderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ TEST_CASE( "CimbReaderTest/testSample", "[unit]" )
++count;
}

string expected = "0=0 99=8 12097=9 12100=0 12196=1 12197=25 12198=33 12200=5 12201=0 12295=32 "
"12296=32 12297=46 12298=32 12299=34 12300=30 12301=32 12394=32 12395=57 "
"12396=37 12397=38 12398=10 12399=15";
string expected = "0=0 99=8 600=33 710=28 711=30 821=8 822=22 823=19 934=55 11688=55 11799=25 "
"11900=28 12000=23 12100=0 12200=5 12201=0 12298=32 12299=34 12300=30 12301=32 "
"12398=10 12399=15";
assertEquals( expected, turbo::str::join(res) );

PositionData pos;
Expand Down Expand Up @@ -109,8 +109,8 @@ TEST_CASE( "CimbReaderTest/testSampleMessy", "[unit]" )
++count;
}

string expected = "0=0 99=8 600=33 711=30 11462=2 11463=16 11573=33 11574=0 11575=1 11685=52 "
"11686=17 11687=41 11688=55 11797=30 11798=15 11799=25 12298=32 12299=34 12300=30 12397=38 12398=10 12399=15";
string expected = "0=0 99=8 600=33 711=30 11462=2 11573=33 11574=0 11685=52 11686=17 11687=41 "
"11688=55 11797=30 11798=15 11799=25 12200=5 12298=46 12299=34 12300=30 12301=32 12397=38 12398=10 12399=15";
assertEquals( expected, turbo::str::join(res) );

PositionData pos;
Expand Down Expand Up @@ -200,7 +200,7 @@ TEST_CASE( "CimbReaderTest/testCCM.VeryNecessary", "[unit]" )
" 0.023812667, 0.98703396, -0.0048082001;\n"
" 0, 0, 1.0017186]", ss.str());

std::array<unsigned, 6> expectedColors = {0, 0, 0, 1, 0, 3}; // it's wrong, but it's consistent!
std::array<unsigned, 6> expectedColors = {0, 0, 0, 0, 0, 3}; // it's wrong, but it's consistent!
for (unsigned i = 0; i < expectedColors.size(); ++i)
{
PositionData pos;
Expand Down
37 changes: 31 additions & 6 deletions src/lib/cimb_translator/test/FloodDecodePositionsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TEST_CASE( "FloodDecodePositionsTest/testSimple", "[unit]" )

// validate seed points
unsigned count = 0;
for (int c = 0; c < 4; ++c)
for (int c = 0; c < 8; ++c)
{
// 0
std::tie(i, xy, drift, cooldown) = cells.next();
Expand Down Expand Up @@ -59,6 +59,30 @@ TEST_CASE( "FloodDecodePositionsTest/testSimple", "[unit]" )
assertEquals(1007, xy.second);
cells.update(i, drift, 2, cooldown);
}
else if (i == 600)
{
assertEquals(8, xy.first);
assertEquals(62, xy.second);
cells.update(i, drift, 2, cooldown);
}
else if (i == 711)
{
assertEquals(1007, xy.first);
assertEquals(62, xy.second);
cells.update(i, drift, 2, cooldown);
}
else if (i == 11688)
{
assertEquals(8, xy.first);
assertEquals(953, xy.second);
cells.update(i, drift, 2, cooldown);
}
else if (i == 11799)
{
assertEquals(1007, xy.first);
assertEquals(953, xy.second);
cells.update(i, drift, 2, cooldown);
}
else
FAIL("i ?= " << i);

Expand All @@ -75,16 +99,17 @@ TEST_CASE( "FloodDecodePositionsTest/testSimple", "[unit]" )
assertEquals(71, xy.first);
assertEquals(8, xy.second);
}
else if (i == 11799)
else if (i == 100)
{
assertEquals(1007, xy.first);
assertEquals(953, xy.second);
assertEquals(62, xy.first);
assertEquals(17, xy.second);
}
else
FAIL("i ?= " << i);

assertEquals(0, drift.x());
assertEquals(0, drift.y());
// we manually set drift to 1,1 -- it should be persisted
assertEquals(1, drift.x());
assertEquals(1, drift.y());

cells.update(i, drift, 3, cooldown);
remainingPos.erase(i);
Expand Down
6 changes: 2 additions & 4 deletions src/lib/encoder/test/DecoderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ TEST_CASE( "DecoderTest/testDecode.Sample", "[unit]" )
unsigned bytesDecoded = dec.decode(TestCimbar::getSample("6bit/4_30_f0_627_extract.jpg"), decodedFile);
assertEquals( 9300, bytesDecoded );

if (CV_VERSION_MAJOR == 3)
assertEquals( "3de927c8aa0221807a2784210160cdc17567eb587bf01233d166900aadf14bf5", get_hash(decodedFile) );
else // # cv4
assertEquals( "de0ecea439e4f7bddb7ffe67ee0cd5e651cd7c7efa25b42c8cf84e0dd41b9e41", get_hash(decodedFile) );
if (CV_VERSION_MAJOR == 4)
assertEquals( "0f74a76cb1f59df7a42449a3527d464d913d12a03bffa51d6f53828724c3feb1", get_hash(decodedFile) );
}

0 comments on commit d452652

Please sign in to comment.