Bug fix for reversing OrderedGroups.

Reverse() method now handles the case where no groups exist.

Change-Id: Ia1ef08aa3cde01ceb71285b605a2e1f882c3b620
This commit is contained in:
Chris Sweeney
2015-03-21 11:55:47 +01:00
committed by Sameer Agarwal
parent 3fafa3cd72
commit 4df3d11397
2 changed files with 18 additions and 0 deletions
+14
View File
@@ -159,6 +159,20 @@ TEST(OrderedGroups, ReverseOrdering) {
EXPECT_EQ(ordering.GroupId(x + 2), 2);
}
TEST(OrderedGroups, ReverseOrderingWithEmptyOrderedGroups) {
ParameterBlockOrdering ordering;
// This should be a no-op.
ordering.Reverse();
// Ensure the properties of an empty OrderedGroups still hold after Reverse().
EXPECT_EQ(ordering.NumGroups(), 0);
EXPECT_EQ(ordering.NumElements(), 0);
EXPECT_EQ(ordering.GroupSize(1), 0);
double x;
EXPECT_EQ(ordering.GroupId(&x), -1);
EXPECT_FALSE(ordering.Remove(&x));
}
TEST(OrderedGroups, BulkRemove) {
ParameterBlockOrdering ordering;
double x[3];