8#include "../../../../tests/testXWC.hpp"
12#include "../../../../libMagAOX/libMagAOX.hpp"
14#define XWC_XIGNODE_TEST
15#include "../staticNode.hpp"
29namespace xInstGraphTest
34 std::ofstream fout(
"/tmp/xigNode_test.xml" );
35 fout <<
"<mxfile host=\"test\">\n";
36 fout <<
" <diagram id=\"test\" name=\"test\">\n";
37 fout <<
" <mxGraphModel>\n";
39 fout <<
" <mxCell id=\"0\"/>\n";
40 fout <<
" <mxCell id=\"1\" parent=\"0\"/>\n";
41 fout <<
" <mxCell id=\"node:ttmpupil\" />\n";
42 fout <<
" <mxCell id=\"input:ttmpupil:in1\" parent=\"node:ttmpupil\" style=\"fontSize=17;\" />\n";
43 fout <<
" <mxCell id=\"input:ttmpupil:in2\" parent=\"node:ttmpupil\" style=\"fontSize=17;\" />\n";
44 fout <<
" <mxCell id=\"input:ttmpupil:in3\" parent=\"node:ttmpupil\" style=\"fontSize=17;\" />\n";
45 fout <<
" <mxCell id=\"input:ttmpupil:in4\" parent=\"node:ttmpupil\" style=\"fontSize=17;\" />\n";
46 fout <<
" <mxCell id=\"output:ttmpupil:out1\" parent=\"node:ttmpupil\" style=\"fontSize=17;\" "
48 fout <<
" <mxCell id=\"output:ttmpupil:out2\" parent=\"node:ttmpupil\" style=\"fontSize=17;\" "
50 fout <<
" <mxCell id=\"output:ttmpupil:out3\" parent=\"node:ttmpupil\" style=\"fontSize=17;\" "
52 fout <<
" <mxCell id=\"output:ttmpupil:out4\" parent=\"node:ttmpupil\" style=\"fontSize=17;\" "
55 fout <<
" </mxGraphModel>\n";
56 fout <<
" </diagram>\n";
57 fout <<
"</mxfile>\n";
61TEST_CASE(
"Creating and configuring an staticNode",
"[instGraph::staticNode]" )
64 #ifdef XINSTGRAPH_TEST_DOXYGEN_REF
70 SECTION(
"node is in file, setting pwr key" )
72 ingr::instGraphXML parentGraph;
74 mx::app::writeConfigFile(
"/tmp/staticNode_test.conf",
75 {
"ttmpupil",
"ttmpupil",
"ttmpupil",
"ttmpupil",
"ttmpupil" },
76 {
"type",
"inputsOn",
"inputsOff",
"outputsOn",
"outputsOff" },
77 {
"static",
"in1,in2",
"in3,in4",
"out1,out2",
"out3,out4" } );
78 mx::app::appConfigurator config;
79 config.readConfig(
"/tmp/staticNode_test.conf" );
83 int rv = parentGraph.loadXMLFile( emsg,
"/tmp/xigNode_test.xml" );
86 REQUIRE( emsg ==
"" );
92 tsn =
new staticNode(
"ttmpupil", &parentGraph );
95 catch(
const std::exception &e )
97 std::cerr << e.what() <<
"\n";
100 REQUIRE( pass ==
true );
101 REQUIRE( tsn !=
nullptr );
103 REQUIRE( tsn->
name() ==
"ttmpupil" );
104 REQUIRE( tsn->
node()->name() ==
"ttmpupil" );
112 catch(
const std::exception &e )
114 std::cerr << e.what() <<
"\n";
117 REQUIRE( pass ==
true );
120 REQUIRE( tsn->
inputsOn().size() == 2 );
121 REQUIRE( tsn->
inputsOn().count(
"in1" ) == 1 );
122 REQUIRE( tsn->
inputsOn().count(
"in2" ) == 1 );
124 REQUIRE( tsn->
inputsOff().count(
"in3" ) == 1 );
125 REQUIRE( tsn->
inputsOff().count(
"in4" ) == 1 );
127 REQUIRE( tsn->
outputsOn().count(
"out1" ) == 1 );
128 REQUIRE( tsn->
outputsOn().count(
"out2" ) == 1 );
130 REQUIRE( tsn->
outputsOff().count(
"out3" ) == 1 );
131 REQUIRE( tsn->
outputsOff().count(
"out4" ) == 1 );
An instGraph node which is static, with status set at config time and not changing.
const std::set< std::string > & inputsOff() const
Get the always off inputs.
const std::set< std::string > & inputsOn() const
Get the always on inputs.
const std::set< std::string > & outputsOn() const
Get the always on outputs.
const std::set< std::string > & outputsOff() const
Get the always off outputs.
void loadConfig(mx::app::appConfigurator &config)
Configure this node form an appConfigurator.
ingr::instNode * node()
Get the pointer to the underlying node.
std::string name()
Get the name of this node.
TEST_CASE("Configuring xInstGraph with no errors", "[xInstGraph]")
Verify xInstGraph configures and runs when given a minimal graph with all supported node types.
void writeXML()
Write a minimal draw.io graph containing one of each supported node type.
Namespace for all libXWC tests.