if test -z "$CXXTESTGEN"; then
AC_PATH_PROG(CXXTESTGEN, cxxtestgen.py, [], [$CXXTEST:$PATH])
fi
+if test -z "$CXXTESTGEN"; then
+ AC_PATH_PROG(CXXTESTGEN, cxxtestgen, [], [$CXXTEST:$PATH])
+fi
if test "$enable_unit_testing" = "no"; then
AC_MSG_NOTICE([unit tests disabled by user request.])
CXXTESTGEN=
CXXTEST=
elif test -z "$CXXTESTGEN"; then
- AC_MSG_NOTICE([unit tests disabled, neither cxxtestgen.pl nor cxxtestgen.py found.])
+ AC_MSG_NOTICE([unit tests disabled, could not find cxxtestgen.pl or cxxtestgen.py or cxxtestgen])
elif test -z "$CXXTEST"; then
CXXTEST=`dirname "$CXXTESTGEN"`
AC_MSG_CHECKING([for location of CxxTest headers])
return d_commandStatus == NULL || dynamic_cast<const CommandSuccess*>(d_commandStatus) != NULL;
}
+bool Command::fail() const throw() {
+ return d_commandStatus != NULL && dynamic_cast<const CommandFailure*>(d_commandStatus) != NULL;
+}
+
void Command::invoke(SmtEngine* smtEngine, std::ostream& out) throw() {
invoke(smtEngine);
printResult(out);
void GetInfoCommand::invoke(SmtEngine* smtEngine) throw() {
try {
- SExpr response = smtEngine->getInfo(d_flag);
+ vector<SExpr> v;
+ v.push_back(SExpr(SExpr::Keyword(string(":") + d_flag)));
+ v.push_back(smtEngine->getInfo(d_flag));
stringstream ss;
- ss << SExpr(SExpr::Keyword(d_flag))
- << ' '
- << response;
+ ss << SExpr(v);
d_result = ss.str();
d_commandStatus = CommandSuccess::instance();
} catch(UnrecognizedOptionException&) {
v.push_back(SExpr(SExpr::Keyword(string(":") + d_flag)));
v.push_back(smtEngine->getOption(d_flag));
stringstream ss;
-
ss << SExpr(v);
d_result = ss.str();
d_commandStatus = CommandSuccess::instance();
std::string toString() const throw();
- /** Either the command hasn't run yet, or it completed successfully. */
+ /**
+ * Either the command hasn't run yet, or it completed successfully
+ * (CommandSuccess, not CommandUnsupported or CommandFailure).
+ */
bool ok() const throw();
+ /**
+ * The command completed in a failure state (CommandFailure, not
+ * CommandSuccess or CommandUnsupported).
+ */
+ bool fail() const throw();
+
/** Get the command status (it's NULL if we haven't run yet). */
const CommandStatus* getCommandStatus() const throw() { return d_commandStatus; }
// have the replay parser use the file's declarations
replayParser->useDeclarationsFrom(parser);
}
- while((cmd = parser->nextCommand()) && status) {
+ while(status && (cmd = parser->nextCommand())) {
if(dynamic_cast<QuitCommand*>(cmd) != NULL) {
delete cmd;
break;
}
- status = doCommand(smt, cmd, opts) && status;
+ status = doCommand(smt, cmd, opts);
delete cmd;
}
// Remove the parser
return true;
}
- // assume no error
- bool status = true;
-
CommandSequence *seq = dynamic_cast<CommandSequence*>(cmd);
if(seq != NULL) {
+ // assume no error
+ bool status = true;
+
for(CommandSequence::iterator subcmd = seq->begin();
- subcmd != seq->end();
+ status && subcmd != seq->end();
++subcmd) {
- status = doCommand(smt, *subcmd, opts) && status;
+ status = doCommand(smt, *subcmd, opts);
}
+
+ return status;
} else {
if(opts[options::verbosity] > 0) {
*opts[options::out] << "Invoking: " << *cmd << endl;
} else {
cmd->invoke(&smt);
}
- status = status && cmd->ok();
+ return !cmd->fail();
}
-
- return status;
}