1 #include "chainerx/dims.h" 2 3 #include <cstdint> 4 #include <sstream> 5 #include <string> 6 7 #include <gtest/gtest.h> 8 9 namespace chainerx { 10 namespace { 11 ToString(const Dims & dims)12std::string ToString(const Dims& dims) { 13 std::ostringstream os; 14 os << DimsFormatter{dims}; 15 return os.str(); 16 } 17 TEST(DimsTest,DimsFormatterTest)18TEST(DimsTest, DimsFormatterTest) { 19 { 20 Dims vec{}; 21 EXPECT_EQ("[]", ToString(vec)); 22 } 23 { 24 Dims vec{1}; 25 EXPECT_EQ("[1]", ToString(vec)); 26 } 27 { 28 Dims vec{1, 2, 3}; 29 EXPECT_EQ("[1, 2, 3]", ToString(vec)); 30 } 31 } 32 33 } // namespace 34 } // namespace chainerx 35