return shape.depth() * shape.height() * shape.width();
}
+inline bool operator==(const Shape &l, const Shape &r)
+{
+ return (l.depth() == r.depth()) && (l.height() == r.height()) && (l.width() == r.width());
+}
+
} // namespace feature
} // namespace ADT
} // namespace core
ASSERT_EQ(num_elements(Shape{C, H, W}), C * H * W);
}
+
+TEST(ADT_FEATURE_SHAPE, operator_eq)
+{
+ using nncc::core::ADT::feature::Shape;
+
+ // NOTE We use ASSERT_TRUE/ASSERT_FALSE instead of ASSERT_EQ/ASSERT_NE as it is impossible to
+ // introduce negative tests with ASSERT_NE (it uses operator!= instead of operator==).
+ ASSERT_TRUE(Shape(1, 1, 1) == Shape(1, 1, 1));
+ ASSERT_FALSE(Shape(1, 1, 1) == Shape(2, 1, 1));
+ ASSERT_FALSE(Shape(1, 1, 1) == Shape(1, 2, 1));
+ ASSERT_FALSE(Shape(1, 1, 1) == Shape(1, 1, 2));
+}