MCPcopy Create free account
hub / github.com/apple/coremltools / testSpanTestsMakeSpanArrayMutable

Function testSpanTestsMakeSpanArrayMutable

mlmodel/tests/MILBlob/SpanTests.cpp:107–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105//----------------------------------------------------------------------
106
107int testSpanTestsMakeSpanArrayMutable()
108{
109 std::array<int, 4> values = {{1, 2, 3, 4}};
110 auto span = MakeSpan(values);
111 static_assert(std::is_same<decltype(span)::value_type, int>::value, "MakeSpan should make non-const T");
112
113 ML_ASSERT(!span.IsEmpty());
114 ML_ASSERT_EQ(span.Size(), size_t(4));
115 ML_ASSERT_EQ(span.Data(), values.data());
116 ML_ASSERT_EQ(span.Get<0>(), 1);
117
118 return 0;
119}
120
121int testSpanTestsMakeSpanArrayForcedImmutable()
122{

Callers

nothing calls this directly

Calls 4

IsEmptyMethod · 0.45
SizeMethod · 0.45
DataMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected