diff --git a/lib/ordered_set.h b/lib/ordered_set.h index 1adfb8c5986..19747d20dd8 100644 --- a/lib/ordered_set.h +++ b/lib/ordered_set.h @@ -99,7 +99,7 @@ class ordered_set { // have a set of ordered_sets (or use ordered_set as a map key). auto it = a.data_map.begin(); for (auto &el : data_map) { - if (it == a.data_map.end()) return true; + if (it == a.data_map.end()) return false; if (mapcmp()(el.first, it->first)) return true; if (mapcmp()(it->first, el.first)) return false; ++it; } diff --git a/test/gtest/ordered_set.cpp b/test/gtest/ordered_set.cpp index d844f919028..d921412acf3 100644 --- a/test/gtest/ordered_set.cpp +++ b/test/gtest/ordered_set.cpp @@ -93,4 +93,15 @@ TEST(ordered_set, set_intersect) { EXPECT_EQ(res, expect); } +TEST(ordered_set, x_is_strict_prefix_of_y) { + ordered_set x; + x.insert(1); + + ordered_set y; + y.insert(1); + y.insert(2); + + EXPECT_LT(x, y); +} + } // namespace Test