1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
5 #include <gtest/gtest.h>
6 #include "xml_father.hpp"
8 using namespace testing;
9 class XMLFatherF : public ::testing::Test {
11 XMLFather x = XMLFather::make_without_schema();
14 TEST_F(XMLFatherF, canCreateValidXmlNode) {
15 ASSERT_STREQ("<net></net>\n", x.node("net").c_str());
18 TEST_F(XMLFatherF, canCreateValidNodeWithName) {
19 ASSERT_STREQ("<net name=\"myname\"></net>\n", x.node("net").attr("name", "myname").c_str());
23 TEST_F(XMLFatherF, canCreateValidXmlNodeWithContent) {
24 ASSERT_STREQ("<net><model>10</model></net>\n", x.node("net").node("model", 10).c_str());
27 TEST_F(XMLFatherF, canCreateValidXmlNodeWithAdvancedContent) {
28 ASSERT_STREQ("<net><model>10 10 12</model></net>\n", x.node("net").node("model", 10, 10, 12).c_str());
31 TEST_F(XMLFatherF, canCreateLevel2Hierarchy) {
32 ASSERT_STREQ("<net><net2><model>10</model></net2></net>\n", x.node("net").node("net2").node("model", 10).c_str());
35 TEST_F(XMLFatherF, canContinueAfterTrivialNode) {
36 ASSERT_STREQ("<net><net2><model>10</model><model2>20</model2></net2></net>\n",
37 x.node("net").node("net2").node("model", 10).node("model2", 20).c_str());
40 TEST_F(XMLFatherF, canContinueAfterNodeWithSubnodes) {
41 ASSERT_STREQ("<net><net2><model>10</model></net2><net4><model4>1</model4></net4></net>\n",