MCPcopy Create free account
hub / github.com/NVIDIA/DALI / TEST

Function TEST

dali/core/tensor_layout_test.cc:28–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 "TensorLayout must be a POD except for non-trivial construction");
27
28TEST(TensorLayout, Construction) {
29 TensorLayout empty;
30 EXPECT_EQ(empty.ndim(), 0);
31 EXPECT_EQ(empty.str(), string());
32 EXPECT_STREQ(empty.c_str(), "");
33
34 TensorLayout from_literal = "NHWC";
35 EXPECT_EQ(from_literal.ndim(), 4);
36 EXPECT_EQ(from_literal.str(), "NHWC");
37 EXPECT_STREQ(from_literal.c_str(), "NHWC");
38
39 const char *cstr = "CHW";
40 TensorLayout from_cstr = cstr;
41 EXPECT_EQ(from_cstr.ndim(), 3);
42 EXPECT_EQ(from_cstr.str(), "CHW");
43 EXPECT_STREQ(from_cstr.c_str(), "CHW");
44
45 TensorLayout from_str = std::string("asdfg");
46 EXPECT_EQ(from_str.ndim(), 5);
47 EXPECT_EQ(from_str.str(), "asdfg");
48 EXPECT_STREQ(from_str.c_str(), "asdfg");
49}
50
51TEST(TensorLayout, MaxLength) {
52 // copy to a local variable to prevent GTest from requiring

Callers

nothing calls this directly

Calls 14

TestTLCompareFunction · 0.85
NumSpatialDimsFunction · 0.85
strMethod · 0.80
skipMethod · 0.80
subMethod · 0.80
sample_layoutMethod · 0.80
is_permutation_ofMethod · 0.80
TensorLayoutClass · 0.50
ndimMethod · 0.45
c_strMethod · 0.45
findMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected