MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / TEST

Function TEST

src/core/test/utils/metahelper.cpp:56–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54} // namespace
55
56TEST(TestMetahelper, SmallSort) {
57 bool fail = false;
58
59 for (int N = 0; N <= 6; ++N) {
60 std::vector<int> arr(N);
61 thin_function<void(int)> gen;
62 gen = [&](int p) {
63 ASSERT_FALSE(fail);
64 if (p == N) {
65 fail = true;
66 auto s0 = arr, s1 = arr;
67 std::sort(s0.begin(), s0.end());
68 small_sort(s1.begin(), s1.end());
69 for (int i = 0; i < N; ++i) {
70 ASSERT_EQ(s0[i], s1[i]) << "fail at " << i;
71 }
72 fail = false;
73 return;
74 }
75 for (int i = 0; i < N; ++i) {
76 arr[p] = i;
77 gen(p + 1);
78 }
79 };
80 gen(0);
81 }
82}
83
84TEST(TestMetahelper, IncompleteStorage) {
85 TestIncompleteStorage::T::dtor = false;

Callers

nothing calls this directly

Calls 8

sortFunction · 0.85
small_sortFunction · 0.85
genFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
emplaceMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected