ASSERT_TRUE(std::all_of(count.begin(), count.end(), [](uint32_t n) { return n == 1; }));
}
+
+TEST(ADT_TENSOR_INDEX_RANGE, range)
+{
+ const nncc::core::ADT::tensor::Shape shape{3, 4};
+
+ std::array<uint32_t, 3 * 4> count;
+
+ count.fill(0);
+
+ using nncc::core::ADT::tensor::Index;
+ using nncc::core::ADT::tensor::range;
+
+ range(shape).iterate() << [&count](const Index &i) {
+ ASSERT_EQ(i.rank(), 2);
+ count.at(i.at(0) * 4 + i.at(1)) += 1;
+ };
+
+ ASSERT_TRUE(std::all_of(count.begin(), count.end(), [](uint32_t n) { return n == 1; }));
+}