From 8813fba7e131f159915675ca846b2554d3e902cb Mon Sep 17 00:00:00 2001 From: Johannes Kalmbach Date: Wed, 15 Jan 2025 10:18:17 +0100 Subject: [PATCH] Add a unit tests. Signed-off-by: Johannes Kalmbach --- test/EngineTest.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/EngineTest.cpp b/test/EngineTest.cpp index e6fcc1e76f..860fa5521e 100644 --- a/test/EngineTest.cpp +++ b/test/EngineTest.cpp @@ -278,6 +278,18 @@ TEST(OptionalJoin, specialOptionalJoinTwoColumns) { IdTable expectedResult = makeIdTableFromVector( {{4, 1, 2, U}, {2, 1, 3, 3}, {1, 1, 4, U}, {2, 2, 2, 4}, {1, 3, 1, 1}}); + testOptionalJoin(a, b, jcls, expectedResult); + } + { + // Test a corner case that previously contained a bug. + IdTable a{makeIdTableFromVector({{4, U, 2}})}; + IdTable b{makeIdTableFromVector({{3, 3, 1}})}; + // Join a and b on the column pairs 1,2 and 2,1 (entries from columns 1 of + // a have to equal those of column 2 of b and vice versa). + JoinColumns jcls{{1, 2}, {2, 1}}; + + IdTable expectedResult = makeIdTableFromVector({{4, U, 2, U}}); + testOptionalJoin(a, b, jcls, expectedResult); } }