From d452652bf6e2fe5fe55a1b32739623d6ad02b0b0 Mon Sep 17 00:00:00 2001 From: sz Date: Sat, 6 May 2023 18:18:10 -0500 Subject: [PATCH] Update regression tests --- .../cimb_translator/test/CimbReaderTest.cpp | 12 +++--- .../test/FloodDecodePositionsTest.cpp | 37 ++++++++++++++++--- src/lib/encoder/test/DecoderTest.cpp | 6 +-- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/lib/cimb_translator/test/CimbReaderTest.cpp b/src/lib/cimb_translator/test/CimbReaderTest.cpp index 65d493c0..6b6723ff 100644 --- a/src/lib/cimb_translator/test/CimbReaderTest.cpp +++ b/src/lib/cimb_translator/test/CimbReaderTest.cpp @@ -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; @@ -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; @@ -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 expectedColors = {0, 0, 0, 1, 0, 3}; // it's wrong, but it's consistent! + std::array expectedColors = {0, 0, 0, 0, 0, 3}; // it's wrong, but it's consistent! for (unsigned i = 0; i < expectedColors.size(); ++i) { PositionData pos; diff --git a/src/lib/cimb_translator/test/FloodDecodePositionsTest.cpp b/src/lib/cimb_translator/test/FloodDecodePositionsTest.cpp index 0d679a3c..6d389319 100644 --- a/src/lib/cimb_translator/test/FloodDecodePositionsTest.cpp +++ b/src/lib/cimb_translator/test/FloodDecodePositionsTest.cpp @@ -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(); @@ -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); @@ -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); diff --git a/src/lib/encoder/test/DecoderTest.cpp b/src/lib/encoder/test/DecoderTest.cpp index eae5563a..16e2bfb2 100644 --- a/src/lib/encoder/test/DecoderTest.cpp +++ b/src/lib/encoder/test/DecoderTest.cpp @@ -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) ); }