diff --git a/source/monad.cpp b/source/monad.cpp index ee94697e6e98c5017754aa8f20daad06b892d10b..89193718feb1a8747fee1aeb2f4be41952c5f164 100644 --- a/source/monad.cpp +++ b/source/monad.cpp @@ -45,6 +45,7 @@ bool newtests = false; bool provided = false; bool verbose = false; +bool detailed = true; bool buffer = true; bool valgrind = false; bool parallel = false; @@ -141,6 +142,7 @@ int main(int argc, const char * const * argv) if (opts::verbose) args.push_back("--verbose"); if (opts::valgrind) args.push_back("--valgrind"); if (!opts::buffer) args.push_back("--noredirect"); + if (!opts::detailed) args.push_back("--nodetailed"); int score = exec("./proxy", args); // TODO (toole1): this causes weird output when scores are like 200 @@ -186,6 +188,7 @@ void monad::processArgs(int argc, const char * const * argv) options.addOption("staff", opts::staff); options.addOption("optimize", opts::optimize); + options.addOption("detailed", opts::detailed); options.addOption("verbose", opts::verbose); options.addOption("buffer", opts::buffer); options.addOption("valgrind", opts::valgrind); diff --git a/source/proxy.cpp b/source/proxy.cpp index 909818f4d63545c477000d0b86d108b197cdaaa9..59824fc8e897ae1798bbf783a46c188019007cd1 100644 --- a/source/proxy.cpp +++ b/source/proxy.cpp @@ -145,6 +145,7 @@ const char * parse_options(int argc, const char * const * const argv, RunTimeEnv parseopts.addOption("verbose", opts.verbose); parseopts.addOption("redirect", opts.redirect_test_output); parseopts.addOption("valgrind", opts.valgrind); + parseopts.addOption("detailed", opts.detailed); parseopts.addArg(getTestName); parseopts.parse(argc, argv); @@ -304,7 +305,8 @@ int RunTests::run_all_tests() const int32_t score = accumulate(results.begin(), results.end(), 0, foldTestScore); cout << endl << endl; - output_detailed_info_if_any_failed(results, score); + if (environment.opts.detailed) + output_detailed_info_if_any_failed(results, score); output::total_score(score, -1); return score; @@ -370,7 +372,12 @@ void RunTests::output_single_test_passfail(const unit_test_result & curr_test) if (curr_test.passed()) std::cout << output::passed_string() << endl; else - std::cout << output::failed_string() << ": " << curr_test.errormsg() << endl; + { + std::cout << output::failed_string(); + if (environment.opts.detailed) + std::cout << ": " << curr_test.errormsg(); + std::cout << endl; + } } test_execution::test_execution(const unit_test_input & _test, RunTimeEnvironment & env, bool enable_valgrind_call) diff --git a/source/proxy.h b/source/proxy.h index eb9782a1582974e757316e4c8600f2401a1b3917..706925b70d469a8df6ec1d934779e270eb5247dd 100644 --- a/source/proxy.h +++ b/source/proxy.h @@ -70,11 +70,13 @@ namespace proxy bool verbose; bool redirect_test_output; bool valgrind; + bool detailed; Options() : verbose(false), redirect_test_output(true), - valgrind(false) + valgrind(false), + detailed(true) { } }; diff --git a/source/util.h b/source/util.h index 9a3829c0334ffeac6754dd0af4d2bc05f9947b12..4cca6cd7ee017234ea1e882807c269b9c9afa98c 100644 --- a/source/util.h +++ b/source/util.h @@ -232,6 +232,16 @@ class Exception : public std::exception }; +template <bool condition, typename T = void> +class enable_if +{ + typedef T type; +}; + +template <typename T> +class enable_if<false, T> +{ }; // No ::type here + // AUTOGRADER