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

Function TEST

src/plugin/test/opr_io_dump.cpp:136–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134} // anonymous namespace
135#if MGB_VERBOSE_TYPEINFO_NAME
136TEST(TestOprIODump, Text) {
137 auto fname_base = output_file("test_opr_iodump");
138 std::array<std::string, 3> fnames;
139 auto make_plugin = [&](ComputingGraph* graph, int level) {
140 fnames.at(level) = ssprintf("%s-%d.txt", fname_base.c_str(), level);
141 auto ret = std::make_unique<TextOprIODump>(graph, fnames[level].c_str());
142 ret->print_addr(false);
143 return ret;
144 };
145
146 auto check_result = [&]() {
147 for (int level = 0; level < 3; ++level) {
148 std::ifstream inp_get{fnames[level]};
149 std::istringstream inp_expect{EXPECTED_TEXT_OUT_REC[level]};
150
151 auto lines_get = getlines(inp_get), lines_expect = getlines(inp_expect, 1);
152 ASSERT_EQ(lines_expect.size(), lines_get.size());
153 for (size_t i = 0; i < lines_expect.size(); ++i) {
154 ASSERT_EQ(lines_expect[i], lines_get[i]) << "fail on line " << i;
155 }
156 }
157 for (auto&& i : fnames) {
158 // clear the content to test if next run does not produce any output
159 debug::write_to_file(i.c_str(), "Lorem ipsum");
160 }
161 };
162
163 run_test(make_plugin, check_result);
164}
165#endif
166
167TEST(TestOprIODump, StdErr) {

Callers

nothing calls this directly

Calls 11

output_fileFunction · 0.85
getlinesFunction · 0.85
make_callback_copyFunction · 0.85
run_testFunction · 0.70
genFunction · 0.50
makeFunction · 0.50
atMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
compileMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected