Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / tests / unit / cnn_network / xml_father_tests.cpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #include <gtest/gtest.h>
6 #include "xml_father.hpp"
7
8 using namespace testing;
9 class XMLFatherF : public ::testing::Test {
10 public:
11     XMLFather x = XMLFather::make_without_schema();
12 };
13
14 TEST_F(XMLFatherF, canCreateValidXmlNode) {
15     ASSERT_STREQ("<net></net>\n", x.node("net").c_str());
16 }
17
18 TEST_F(XMLFatherF, canCreateValidNodeWithName) {
19     ASSERT_STREQ("<net name=\"myname\"></net>\n", x.node("net").attr("name", "myname").c_str());
20 }
21
22
23 TEST_F(XMLFatherF, canCreateValidXmlNodeWithContent) {
24     ASSERT_STREQ("<net><model>10</model></net>\n", x.node("net").node("model", 10).c_str());
25 }
26
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());
29 }
30
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());
33 }
34
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());
38 }
39
40 TEST_F(XMLFatherF, canContinueAfterNodeWithSubnodes) {
41     ASSERT_STREQ("<net><net2><model>10</model></net2><net4><model4>1</model4></net4></net>\n",
42                  x.node("net")
43                     .node("net2")
44                         .node("model", 10)
45                     .close()
46                     .node("net4")
47                         .node("model4", 1)
48                  .c_str());
49 }