Files
2017-04-11 15:49:55 +02:00

164 lines
6.7 KiB
Plaintext
Executable File

std::cout << "AtomicActivity2:" << std::endl
<< "\telements1Count: " << sin->elements1Count.getValue() << std::endl
<< "\telements2Count: " << sin->elements2Count.getValue() << std::endl
<< "\tloopPort1: " << sin->loopPort1.getValue() << std::endl
<< "\tloopPort2: " << sin->loopPort2.getValue() << std::endl
<< "\toutPort1: " << sin->outPort1.getValue() << std::endl
<< "\toutPort2: " << sin->outPort2.getValue() << std::endl
<< "\toutLoopPort1: " << sin->outLoopPort1.getValue() << std::endl
<< "\toutLoopPort2: " << sin->outLoopPort2.getValue() << std::endl;
#include <algorithm>
auto elemMin = std::min(sin->elements1Count.getValue(), sin->elements2Count.getValue());
if (elemMin <= 0) {
std::stringstream ss;
ss << "Test Failure: elemMin [" << elemMin << "] is not greater than zero.";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (sin->loopPort1.getValue() != elemMin) {
std::stringstream ss;
ss << "Test Failure: loopPort1 [" << sin->loopPort1.getValue() << "] is not equal elemMin [" << elemMin << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (sin->loopPort2.getValue() != elemMin) {
std::stringstream ss;
ss << "Test Failure: loopPort2 [" << sin->loopPort2.getValue() << "] is not equal elemMin [" << elemMin << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (sin->outPort1.getValue() != elemMin) {
std::stringstream ss;
ss << "Test Failure: outPort1 [" << sin->outPort1.getValue() << "] is not equal elemMin [" << elemMin << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (sin->outPort2.getValue() != elemMin) {
std::stringstream ss;
ss << "Test Failure: outPort2 [" << sin->outPort2.getValue() << "] is not equal elemMin [" << elemMin << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (sin->outLoopPort1.getValue() != elemMin) {
std::stringstream ss;
ss << "Test Failure: outLoopPort1 [" << sin->outLoopPort1.getValue() << "] is not equal elemMin [" << elemMin << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (sin->outLoopPort2.getValue() != elemMin) {
std::stringstream ss;
ss << "Test Failure: outLoopPort2 [" << sin->outLoopPort2.getValue() << "] is not equal elemMin [" << elemMin << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (sin->elements1orig.getSize() != sin->elements1Count.getValue()) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: elements1orig collection size [" << sin->elements1orig.getSize() << "] is not equal elements1Count [" << sin->elements1Count.getValue() << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
std::cout << "\telements1orig: [ ";
bool isFirst = true;
for (wfr_id_t t = 0; t < sin->elements1orig.getSize(); t++) {
if (sin->elements1orig.getEntryValue(t) != t+1) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: elements1orig collection value index [" << t << "] does not have correct value [" << sin->elements1orig.getEntryValue(t)<< "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (isFirst) {
isFirst = false;
} else {
std::cout << ", ";
}
std::cout << sin->elements1orig.getEntryValue(t);
}
std::cout << " ]" << std::endl;
if (sin->elements2orig.getSize() != sin->elements2Count.getValue()) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: elements2orig collection size [" << sin->elements2orig.getSize() << "] is not equal elements2Count [" << sin->elements2Count.getValue() << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
std::cout << "\telements2orig: [ ";
isFirst = true;
for (wfr_id_t t = 0; t < sin->elements2orig.getSize(); t++) {
if (sin->elements2orig.getEntryValue(t) != t+1) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: elements2orig collection value index [" << t << "] does not have correct value [" << sin->elements2orig.getEntryValue(t)<< "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (isFirst) {
isFirst = false;
} else {
std::cout << ", ";
}
std::cout << sin->elements2orig.getEntryValue(t);
}
std::cout << " ]" << std::endl;
if (sin->elements1in.getSize() != elemMin) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: elements1in collection size [" << sin->elements1in.getSize() << "] is not equal elemMin [" << elemMin << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
std::cout << "\telements1in: [ ";
isFirst = true;
for (wfr_id_t t = 0; t < sin->elements1in.getSize(); t++) {
if (sin->elements1in.getEntryValue(t) != t+1) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: elements1in collection value index [" << t << "] does not have correct value [" << sin->elements1in.getEntryValue(t)<< "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (isFirst) {
isFirst = false;
} else {
std::cout << ", ";
}
std::cout << sin->elements1in.getEntryValue(t);
}
std::cout << " ]" << std::endl;
if (sin->elements2in.getSize() != elemMin) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: elements2in collection size [" << sin->elements2in.getSize() << "] is not equal elemMin [" << elemMin << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
std::cout << "\telements2in: [ ";
isFirst = true;
for (wfr_id_t t = 0; t < sin->elements2in.getSize(); t++) {
if (sin->elements2in.getEntryValue(t) != t+1) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: elements2in collection value index [" << t << "] does not have correct value [" << sin->elements2in.getEntryValue(t)<< "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (isFirst) {
isFirst = false;
} else {
std::cout << ", ";
}
std::cout << sin->elements2in.getEntryValue(t);
}
std::cout << " ]" << std::endl;
if (sin->isOkUnion1.getSize() != elemMin) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: isOkUnion1 collection size [" << sin->isOkUnion1.getSize() << "] is not equal elemMin [" << elemMin << "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
std::cout << "\tisOkUnion1: [ ";
isFirst = true;
for (wfr_id_t t = 0; t < sin->isOkUnion1.getSize(); t++) {
if (!sin->isOkUnion1.getEntryValue(t)) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: isOkUnion1 collection value index [" << t << "] does not have correct value [" << sin->isOkUnion1.getEntryValue(t)<< "].";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (isFirst) {
isFirst = false;
} else {
std::cout << ", ";
}
std::cout << sin->isOkUnion1.getEntryValue(t);
}
std::cout << " ]" << std::endl;
sout->elements1 = sin->elements1in;
sout->elements2 = sin->elements2in;
sout->isOK.setValue(true);