MCPcopy Create free account
hub / github.com/atomic14/diy-esp32-epub-reader / test_xml_parser

Function test_xml_parser

test/tinyxml_html_parser.cpp:31–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29};
30
31void test_xml_parser(void)
32{
33 FILE *fp = fopen("fixtures/test.html", "rb");
34 TEST_ASSERT_NOT_NULL_MESSAGE(fp, "Failed to open test.html");
35 fseek(fp, 0, SEEK_END);
36 long fsize = ftell(fp);
37 fseek(fp, 0, SEEK_SET); //same as rewind(f);
38
39 char *html = (char *)malloc(fsize + 1);
40 fread(html, fsize, 1, fp);
41 html[fsize] = 0;
42
43 tinyxml2::XMLDocument doc(false, tinyxml2::COLLAPSE_WHITESPACE);
44 auto result = doc.Parse(html);
45 TEST_ASSERT_EQUAL(tinyxml2::XML_SUCCESS, result);
46 auto body = doc.FirstChildElement("html")->FirstChildElement("body");
47 TEST_ASSERT_NOT_NULL_MESSAGE(body, "Body element not found");
48 body->Accept(new MyVisitor());
49}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected