MCPcopy Create free account
hub / github.com/apache/tvm-ffi / TEST

Function TEST

tests/cpp/test_rvalue_ref.cc:32–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30using namespace tvm::ffi::testing;
31
32TEST(RValueRef, Basic) {
33 auto append =
34 Function::FromTyped([](RValueRef<Array<int>> ref, int val, bool is_unique) -> Array<int> {
35 Array<int> arr = *std::move(ref);
36 EXPECT_EQ(arr.unique(), is_unique);
37 arr.push_back(val);
38 return arr;
39 });
40 auto a = append(RValueRef(Array<int>({1, 2})), 3, true).cast<Array<int>>();
41 EXPECT_EQ(a.size(), 3);
42 a = append(RValueRef(std::move(a)), 4, true).cast<Array<int>>();
43 EXPECT_EQ(a.size(), 4);
44 // pass in lvalue instead, the append still will succeed but array will not be unique
45 a = append(a, 5, false).cast<Array<int>>();
46 EXPECT_EQ(a.size(), 5);
47}
48
49TEST(RValueRef, ParamChecking) {
50 // try decution

Callers

nothing calls this directly

Calls 7

RValueRefClass · 0.85
TIntClass · 0.70
uniqueMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
kindMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected