Files
WFR-UnitTests/iwir/coderepo/if2/atomic3.code
T
2017-04-11 15:49:55 +02:00

44 lines
1.4 KiB
Plaintext
Executable File

std::cout << "AtomicActivity3:" << std::endl;
if (sin->input.getSize() <= 0) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: input size [" << sin->input.getSize() << "] is not greater than zero.";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (sin->input.getSize() != sin->gIn1.getSize()) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: input [" << sin->input.getSize() << "] and gIn1 [" << sin->gIn1.getSize() << "] differ in size.";
throw wfr::exception::wfr_fatal_error(ss.str());
}
std::cout << "\tgIn1: [ ";
bool isFirst = true;
for (wfr_id_t t = 0; t < sin->gIn1.getSize(); t++) {
if (isFirst) {
isFirst = false;
} else {
std::cout << ", ";
}
std::cout << sin->gIn1.getEntryValue(t);
}
std::cout << " ]" << std::endl;
std::cout << "\tinput: [ ";
isFirst = true;
for (wfr_id_t t = 0; t < sin->input.getSize(); t++) {
if ( (sin->gIn1.getEntryValue(t) && sin->input.getEntryValue(t) != 10) ||
(!sin->gIn1.getEntryValue(t) && sin->input.getEntryValue(t) != -10) ) {
#include <sstream>
std::stringstream ss;
ss << "Test Failure: input [" << sin->input.getEntryValue(t) << "] and gIn1 [" << sin->gIn1.getEntryValue(t) << "] do not match.";
throw wfr::exception::wfr_fatal_error(ss.str());
}
if (isFirst) {
isFirst = false;
} else {
std::cout << ", ";
}
std::cout << sin->input.getEntryValue(t);
}
std::cout << " ]" << std::endl;
sout->isOk.setValue(true);