From 7ba40a9b7476e6858819ebe73315b9d01b599d2c Mon Sep 17 00:00:00 2001 From: geigle1 <geigle1@6fbd10e7-183d-0410-a318-cb416676e4f2> Date: Wed, 29 Aug 2012 05:59:13 +0000 Subject: [PATCH] Update monad. git-svn-id: https://subversion.cs.illinois.edu/svn/cs225@7659 6fbd10e7-183d-0410-a318-cb416676e4f2 --- source/monad.cpp | 3 +++ source/proxy.cpp | 11 +++++++++-- source/proxy.h | 4 +++- source/util.h | 10 ++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/source/monad.cpp b/source/monad.cpp index ee94697..8919371 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 909818f..59824fc 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 eb9782a..706925b 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 9a3829c..4cca6cd 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 -- GitLab