.
This commit is contained in:
+2
-1
@@ -56,7 +56,7 @@ ADD_DEFINITIONS( -std=c++11 -DSPARSELU_SKIP_BOTS_MAIN )
|
|||||||
function(add_wfr_utest utest_name add_inc)
|
function(add_wfr_utest utest_name add_inc)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${utest_name})
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${utest_name})
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.h
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.h
|
||||||
COMMAND ${IWIR2WFR_EXE} -i ${IWIR_DIR}/${utest_name}.iwir -o ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name} -skipmain -printir -repoconfig ${REPO_DIR}/${utest_name}.properties
|
COMMAND ${IWIR2WFR_EXE} -i ${IWIR_DIR}/${utest_name}.iwir -o ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name} -printir -repoconfig ${REPO_DIR}/${utest_name}.properties
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}
|
||||||
)
|
)
|
||||||
add_executable(${utest_name}.bin ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.cpp ${ARGN})
|
add_executable(${utest_name}.bin ${CMAKE_CURRENT_BINARY_DIR}/${utest_name}/${utest_name}.cpp ${ARGN})
|
||||||
@@ -74,6 +74,7 @@ endfunction()
|
|||||||
add_wfr_utest(for1 "")
|
add_wfr_utest(for1 "")
|
||||||
add_wfr_utest(foreach1 "")
|
add_wfr_utest(foreach1 "")
|
||||||
add_wfr_utest(if1 "")
|
add_wfr_utest(if1 "")
|
||||||
|
#add_wfr_utest(if01 "")
|
||||||
add_wfr_utest(if2 "")
|
add_wfr_utest(if2 "")
|
||||||
add_wfr_utest(pfor1 "")
|
add_wfr_utest(pfor1 "")
|
||||||
add_wfr_utest(pforeach1 "")
|
add_wfr_utest(pforeach1 "")
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ exec_test() {
|
|||||||
echo -n -e "$PROLOG"
|
echo -n -e "$PROLOG"
|
||||||
|
|
||||||
let TOTAL_COUNT=$TOTAL_COUNT+1
|
let TOTAL_COUNT=$TOTAL_COUNT+1
|
||||||
|
#echo LD_LIBRARY_PATH=$LIBRARY_PATH timeout $TIMELIMIT ./$BINARY
|
||||||
OUTPUT=$(LD_LIBRARY_PATH=$LIBRARY_PATH timeout $TIMELIMIT ./$BINARY 1>/dev/null 2>&1)
|
OUTPUT=$(LD_LIBRARY_PATH=$LIBRARY_PATH timeout $TIMELIMIT ./$BINARY 1>/dev/null 2>&1)
|
||||||
CODE=$?
|
CODE=$?
|
||||||
RESULT=""
|
RESULT=""
|
||||||
@@ -78,6 +79,16 @@ exec_test 10 "$BIN_BASE/while1/while1.bin --early-evaluation"
|
|||||||
exec_test 10 "$BIN_BASE/while1/while1.bin --late-evaluation"
|
exec_test 10 "$BIN_BASE/while1/while1.bin --late-evaluation"
|
||||||
exec_test 10 "$BIN_BASE/if1/if1.bin --early-evaluation"
|
exec_test 10 "$BIN_BASE/if1/if1.bin --early-evaluation"
|
||||||
exec_test 10 "$BIN_BASE/if1/if1.bin --late-evaluation"
|
exec_test 10 "$BIN_BASE/if1/if1.bin --late-evaluation"
|
||||||
|
exec_test 10 "$BIN_BASE/if1/if1.bin --early-evaluation --if1 false"
|
||||||
|
exec_test 10 "$BIN_BASE/if1/if1.bin --late-evaluation --if1 false"
|
||||||
|
exec_test 10 "$BIN_BASE/if1/if1.bin --early-evaluation --if2 false"
|
||||||
|
exec_test 10 "$BIN_BASE/if1/if1.bin --late-evaluation --if2 false"
|
||||||
|
exec_test 10 "$BIN_BASE/if1/if1.bin --early-evaluation --if3 false"
|
||||||
|
exec_test 10 "$BIN_BASE/if1/if1.bin --late-evaluation --if3 false"
|
||||||
|
exec_test 10 "$BIN_BASE/if1/if1.bin --early-evaluation --if4 false"
|
||||||
|
exec_test 10 "$BIN_BASE/if1/if1.bin --late-evaluation --if4 false"
|
||||||
|
exec_test 10 "$BIN_BASE/if1/if1.bin --early-evaluation --ifall false"
|
||||||
|
exec_test 10 "$BIN_BASE/if1/if1.bin --late-evaluation --ifall false"
|
||||||
exec_test 10 "$BIN_BASE/if2/if2.bin --early-evaluation"
|
exec_test 10 "$BIN_BASE/if2/if2.bin --early-evaluation"
|
||||||
exec_test 10 "$BIN_BASE/if2/if2.bin --late-evaluation"
|
exec_test 10 "$BIN_BASE/if2/if2.bin --late-evaluation"
|
||||||
#exec_test 30 "$BIN_BASE/wavefront/wavefront.bin --early-evaluation"
|
#exec_test 30 "$BIN_BASE/wavefront/wavefront.bin --early-evaluation"
|
||||||
|
|||||||
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
wfinput=if01/wfInput.code
|
||||||
|
wfoutput=if01/wfOutput.code
|
||||||
|
includes=if01/includes.code
|
||||||
|
|
||||||
|
atomicTask.0=if01/atomic1.properties
|
||||||
|
atomicTask.1=if01/atomic2.properties
|
||||||
|
atomicTask.2=if01/atomic3.properties
|
||||||
|
|
||||||
Executable
+3
@@ -0,0 +1,3 @@
|
|||||||
|
sout->if1condOut.setValue(sin->if1cond.getValue());
|
||||||
|
sout->if1ValueOut.setValue(sin->if1Value.getValue());
|
||||||
|
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
name=AtomicActivity1
|
||||||
|
entries=1
|
||||||
|
entry.0=atomic1.code
|
||||||
Executable
+16
@@ -0,0 +1,16 @@
|
|||||||
|
std::cout << "AtomicActivity2:" << std::endl
|
||||||
|
<< "\tif1cond: " << sin->if1cond.getValue() << std::endl
|
||||||
|
<< "\tif1value: " << sin->if1Value.getValue() << std::endl;
|
||||||
|
if (!sin->if1cond.getValue()) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if1cond [" << sin->if1cond.getValue() << "] is not true.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
}
|
||||||
|
if (sin->if1Value.getValue() != -1) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if1Value [" << sin->if1Value.getValue() << "] is not -1.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
}
|
||||||
|
sout->if1ValueOut.setValue(2);
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
name=AtomicActivity2
|
||||||
|
entries=1
|
||||||
|
entry.0=atomic2.code
|
||||||
Executable
+16
@@ -0,0 +1,16 @@
|
|||||||
|
std::cout << "AtomicActivity3:" << std::endl
|
||||||
|
<< "\tif1cond: " << sin->if1Cond.getValue() << std::endl
|
||||||
|
<< "\tif1value: " << sin->if1Value.getValue() << std::endl;
|
||||||
|
if (sin->if1Cond.getValue()) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if1cond [" << sin->if1Cond.getValue() << "] is not false.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
}
|
||||||
|
if (sin->if1Value.getValue() != -1) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if1Value [" << sin->if1Value.getValue() << "] is not -1.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
}
|
||||||
|
sout->if1ValueOut.setValue(3);
|
||||||
Executable
+4
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
name=AtomicActivity3
|
||||||
|
entries=1
|
||||||
|
entry.0=atomic3.code
|
||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#include <boost/program_options.hpp>
|
||||||
|
#include <thread>
|
||||||
Executable
+47
@@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
bool isHelp = false;
|
||||||
|
bool if1Cond = true;
|
||||||
|
bool if2Cond = true;
|
||||||
|
bool if3Cond = true;
|
||||||
|
bool if4Cond = true;
|
||||||
|
boost::program_options::options_description opts("if1 Options");
|
||||||
|
opts.add_options()
|
||||||
|
("help", "Print help message.")
|
||||||
|
("if1", boost::program_options::value<bool>(), "if1 condition")
|
||||||
|
("if2", boost::program_options::value<bool>(), "if2 condition")
|
||||||
|
("if3", boost::program_options::value<bool>(), "if3 condition")
|
||||||
|
("if4", boost::program_options::value<bool>(), "if4 condition");
|
||||||
|
boost::program_options::variables_map vm;
|
||||||
|
auto parsed = boost::program_options::command_line_parser(argc, argv).options(opts).allow_unregistered().run();
|
||||||
|
boost::program_options::store(parsed, vm);
|
||||||
|
boost::program_options::notify(vm);
|
||||||
|
if (vm.count("help")) {
|
||||||
|
std::cerr << opts << std::endl;
|
||||||
|
isHelp = true;
|
||||||
|
} else {
|
||||||
|
if (vm.count("if1")) {
|
||||||
|
if1Cond = vm["if1"].as<bool>();
|
||||||
|
}
|
||||||
|
if (vm.count("if2")) {
|
||||||
|
if2Cond = vm["if2"].as<bool>();
|
||||||
|
}
|
||||||
|
if (vm.count("if3")) {
|
||||||
|
if3Cond = vm["if3"].as<bool>();
|
||||||
|
}
|
||||||
|
if (vm.count("if4")) {
|
||||||
|
if4Cond = vm["if4"].as<bool>();
|
||||||
|
}
|
||||||
|
std::cerr << "if1 = " << if1Cond << std::endl;
|
||||||
|
std::cerr << "if2 = " << if2Cond << std::endl;
|
||||||
|
std::cerr << "if3 = " << if3Cond << std::endl;
|
||||||
|
std::cerr << "if4 = " << if4Cond << std::endl;
|
||||||
|
}
|
||||||
|
wfInput.if1cond.setValue(if1Cond);
|
||||||
|
wfInput.if2cond.setValue(if2Cond);
|
||||||
|
wfInput.if3cond.setValue(if3Cond);
|
||||||
|
wfInput.if4cond.setValue(if4Cond);
|
||||||
|
wfInput.if1Value.setValue(-1);
|
||||||
|
wfInput.if2Value.setValue(-1);
|
||||||
|
wfInput.if3Value.setValue(-1);
|
||||||
|
wfInput.if4Value.setValue(-1);
|
||||||
|
|
||||||
Executable
+63
@@ -0,0 +1,63 @@
|
|||||||
|
std::cout << "wfOutput:" << std::endl
|
||||||
|
<< "\tisOk1: " << wfOutput.isOk1.getValue() << std::endl
|
||||||
|
<< "\tisOk2: " << wfOutput.isOk2.getValue() << std::endl
|
||||||
|
<< "\tif1valueOut: " << wfOutput.if1valueOut.getValue() << std::endl
|
||||||
|
<< "\tif2valueOut: " << wfOutput.if2ValueOut.getValue() << std::endl
|
||||||
|
<< "\tif3valueOut: " << wfOutput.if3ValueOut.getValue() << std::endl
|
||||||
|
<< "\tif4valueOut: " << wfOutput.if4ValueOut.getValue() << std::endl;
|
||||||
|
if (wfOutput.isOk1.getValue() != true) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: isOk1 [" << wfOutput.isOk1.getValue() << "] is not true.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
}
|
||||||
|
if (wfOutput.isOk2.getValue() != true) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: isOk2 [" << wfOutput.isOk2.getValue() << "] is not true.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
}
|
||||||
|
if (wfInput.if1cond.getValue() && wfOutput.if1valueOut.getValue() != 2) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if1valueOut [" << wfOutput.if1valueOut.getValue() << "] is not 2.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
} else if (!wfInput.if1cond.getValue() && wfOutput.if1valueOut.getValue() != 3) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if1valueOut [" << wfOutput.if1valueOut.getValue() << "] is not 3.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
}
|
||||||
|
if (wfInput.if2cond.getValue() && wfOutput.if2ValueOut.getValue() != 4) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if2valueOut [" << wfOutput.if2ValueOut.getValue() << "] is not 4.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
} else if (!wfInput.if2cond.getValue() && wfOutput.if2ValueOut.getValue() != -1) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if2valueOut [" << wfOutput.if2ValueOut.getValue() << "] is not -1.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
}
|
||||||
|
if (wfInput.if3cond.getValue() && wfOutput.if3ValueOut.getValue() != -1) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if3valueOut [" << wfOutput.if3ValueOut.getValue() << "] is not -1.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
} else if (!wfInput.if3cond.getValue() && wfOutput.if3ValueOut.getValue() != 6) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if3valueOut [" << wfOutput.if3ValueOut.getValue() << "] is not 6.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
}
|
||||||
|
if (wfInput.if4cond.getValue() && wfOutput.if4ValueOut.getValue() != 7) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if4valueOut [" << wfOutput.if4ValueOut.getValue() << "] is not 7.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
} else if (!wfInput.if4cond.getValue() && wfOutput.if4ValueOut.getValue() != -1) {
|
||||||
|
#include <sstream>
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << "Test Failure: if4valueOut [" << wfOutput.if4ValueOut.getValue() << "] is not -1.";
|
||||||
|
throw wfr::exception::wfr_fatal_error(ss.str());
|
||||||
|
}
|
||||||
@@ -10,7 +10,8 @@
|
|||||||
("if1", boost::program_options::value<bool>(), "if1 condition")
|
("if1", boost::program_options::value<bool>(), "if1 condition")
|
||||||
("if2", boost::program_options::value<bool>(), "if2 condition")
|
("if2", boost::program_options::value<bool>(), "if2 condition")
|
||||||
("if3", boost::program_options::value<bool>(), "if3 condition")
|
("if3", boost::program_options::value<bool>(), "if3 condition")
|
||||||
("if4", boost::program_options::value<bool>(), "if4 condition");
|
("if4", boost::program_options::value<bool>(), "if4 condition")
|
||||||
|
("ifall", boost::program_options::value<bool>(), "all if conditions");
|
||||||
boost::program_options::variables_map vm;
|
boost::program_options::variables_map vm;
|
||||||
auto parsed = boost::program_options::command_line_parser(argc, argv).options(opts).allow_unregistered().run();
|
auto parsed = boost::program_options::command_line_parser(argc, argv).options(opts).allow_unregistered().run();
|
||||||
boost::program_options::store(parsed, vm);
|
boost::program_options::store(parsed, vm);
|
||||||
@@ -31,6 +32,13 @@
|
|||||||
if (vm.count("if4")) {
|
if (vm.count("if4")) {
|
||||||
if4Cond = vm["if4"].as<bool>();
|
if4Cond = vm["if4"].as<bool>();
|
||||||
}
|
}
|
||||||
|
if (vm.count("ifall")) {
|
||||||
|
auto val = vm["ifall"].as<bool>();
|
||||||
|
if1Cond = val;
|
||||||
|
if2Cond = val;
|
||||||
|
if3Cond = val;
|
||||||
|
if4Cond = val;
|
||||||
|
}
|
||||||
std::cerr << "if1 = " << if1Cond << std::endl;
|
std::cerr << "if1 = " << if1Cond << std::endl;
|
||||||
std::cerr << "if2 = " << if2Cond << std::endl;
|
std::cerr << "if2 = " << if2Cond << std::endl;
|
||||||
std::cerr << "if3 = " << if3Cond << std::endl;
|
std::cerr << "if3 = " << if3Cond << std::endl;
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
<IWIR version="1.1" wfname="UTest_Conditional1" xmlns="http://shiwa-workflow.eu/IWIR">
|
||||||
|
<blockScope name="toplevel">
|
||||||
|
<inputPorts>
|
||||||
|
<inputPort name="if1cond" type="boolean"/>
|
||||||
|
<inputPort name="if1Value" type="integer"/>
|
||||||
|
</inputPorts>
|
||||||
|
<body>
|
||||||
|
<task name="AtomicActivity1" tasktype="AtomicActivity1">
|
||||||
|
<inputPorts>
|
||||||
|
<inputPort name="if1cond" type="boolean"/>
|
||||||
|
<inputPort name="if1Value" type="integer"/>
|
||||||
|
</inputPorts>
|
||||||
|
<outputPorts>
|
||||||
|
<outputPort name="if1condOut" type="boolean"/>
|
||||||
|
<outputPort name="if1ValueOut" type="integer"/>
|
||||||
|
</outputPorts>
|
||||||
|
</task>
|
||||||
|
<if name="DecisionNode1">
|
||||||
|
<inputPorts>
|
||||||
|
<inputPort name="if1cond" type="boolean"/>
|
||||||
|
<inputPort name="if1Value" type="integer"/>
|
||||||
|
</inputPorts>
|
||||||
|
<condition>if1cond = true</condition>
|
||||||
|
<then>
|
||||||
|
<task name="AtomicActivity2" tasktype="AtomicActivity2">
|
||||||
|
<inputPorts>
|
||||||
|
<inputPort name="if1cond" type="boolean"/>
|
||||||
|
<inputPort name="if1Value" type="integer"/>
|
||||||
|
</inputPorts>
|
||||||
|
<outputPorts>
|
||||||
|
<outputPort name="if1ValueOut" type="integer"/>
|
||||||
|
</outputPorts>
|
||||||
|
</task>
|
||||||
|
</then>
|
||||||
|
<else>
|
||||||
|
<task name="AtomicActivity3" tasktype="AtomicActivity3">
|
||||||
|
<inputPorts>
|
||||||
|
<inputPort name="if1Cond" type="boolean"/>
|
||||||
|
<inputPort name="if1Value" type="integer"/>
|
||||||
|
</inputPorts>
|
||||||
|
<outputPorts>
|
||||||
|
<outputPort name="if1ValueOut" type="integer"/>
|
||||||
|
</outputPorts>
|
||||||
|
</task>
|
||||||
|
</else>
|
||||||
|
<outputPorts>
|
||||||
|
<outputPort name="if1ValueOut" type="integer"/>
|
||||||
|
</outputPorts>
|
||||||
|
<links>
|
||||||
|
<link from="DecisionNode1/if1Value" to="AtomicActivity2/if1Value"/>
|
||||||
|
<link from="DecisionNode1/if1cond" to="AtomicActivity2/if1cond"/>
|
||||||
|
<link from="DecisionNode1/if1cond" to="AtomicActivity3/if1Cond"/>
|
||||||
|
<link from="DecisionNode1/if1Value" to="AtomicActivity3/if1Value"/>
|
||||||
|
<link from="AtomicActivity2/if1ValueOut" to="DecisionNode1/if1ValueOut"/>
|
||||||
|
<link from="AtomicActivity3/if1ValueOut" to="DecisionNode1/if1ValueOut"/>
|
||||||
|
</links>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<outputPorts>
|
||||||
|
<outputPort name="if1valueOut" type="integer"/>
|
||||||
|
</outputPorts>
|
||||||
|
<links>
|
||||||
|
<link from="toplevel/if1Value" to="AtomicActivity1/if1Value"/>
|
||||||
|
<link from="toplevel/if1cond" to="AtomicActivity1/if1cond"/>
|
||||||
|
<link from="AtomicActivity1/if1condOut" to="DecisionNode1/if1cond"/>
|
||||||
|
<link from="AtomicActivity1/if1ValueOut" to="DecisionNode1/if1Value"/>
|
||||||
|
<link from="DecisionNode1/if1ValueOut" to="toplevel/if1valueOut"/>
|
||||||
|
</links>
|
||||||
|
<properties>
|
||||||
|
<property name="version" value="1.0.0"/>
|
||||||
|
<property name="author" value="matthias"/>
|
||||||
|
<property name="domain" value="Generic"/>
|
||||||
|
</properties>
|
||||||
|
</blockScope>
|
||||||
|
</IWIR>
|
||||||
Reference in New Issue
Block a user