1 #include <gtest/gtest.h> 3 #include <torch/expanding_array.h> 5 #include <test/cpp/api/support.h> 8 #include <initializer_list> 15 ASSERT_EQ(e.size(), 5);
16 for (
size_t i = 0; i < e.size(); ++i) {
17 ASSERT_EQ((*e)[i], i + 1);
23 ASSERT_EQ(e.size(), 5);
24 for (
size_t i = 0; i < e.size(); ++i) {
25 ASSERT_EQ((*e)[i], i + 1);
31 ASSERT_EQ(e.
size(), 5);
32 for (
size_t i = 0; i < e.
size(); ++i) {
33 ASSERT_EQ((*e)[i], i + 1);
39 ASSERT_EQ(e.
size(), 5);
40 for (
size_t i = 0; i < e.
size(); ++i) {
41 ASSERT_EQ((*e)[i], 5);
47 ThrowsWhenConstructedWithIncorrectNumberOfArgumentsInInitializerList) {
50 "Expected 5 values, but instead got 7");
55 ThrowsWhenConstructedWithIncorrectNumberOfArgumentsInVector) {
58 "Expected 5 values, but instead got 7");
size_t size() const noexcept
Returns the extent of the ExpandingArray.
A utility class that accepts either a container of D-many values, or a single value, which is internally repeated D times.