Update deps (fix microunit bug).

This commit is contained in:
davidjacnogueira
2017-10-11 01:16:35 +01:00
parent 66aabc79b3
commit f924edd50a

18
deps/microunit.h vendored
View File

@@ -1,6 +1,6 @@
/** /**
* @file microunit.h * @file microunit.h
* @version 0.1 * @version 0.2
* @author Sebastiao Salvador de Miranda (ssm) * @author Sebastiao Salvador de Miranda (ssm)
* @brief Tiny library for cpp unit testing. Should work on any c++11 compiler. * @brief Tiny library for cpp unit testing. Should work on any c++11 compiler.
* *
@@ -25,7 +25,7 @@
* } * }
* @endcode * @endcode
* *
* @copyright Copyright (c) 2016, Sebastiao Salvador de Miranda. * @copyright Copyright (c) 2016-2017, Sebastiao Salvador de Miranda.
* All rights reserved. See licence below. * All rights reserved. See licence below.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -94,8 +94,8 @@ const static int COLORCODE_YELLOW{ 14 };
std::string ColorCodeToANSI(const int color_code) { std::string ColorCodeToANSI(const int color_code) {
switch (color_code) { switch (color_code) {
case COLORCODE_GREY: return "\033[22;37m"; case COLORCODE_GREY: return "\033[22;37m";
case COLORCODE_GREEN: return "\033[01;31m"; case COLORCODE_GREEN: return "\033[01;32m";
case COLORCODE_RED: return "\033[01;32m"; case COLORCODE_RED: return "\033[01;31m";
case COLORCODE_YELLOW: return "\033[01;33m"; case COLORCODE_YELLOW: return "\033[01;33m";
default: return ""; default: return "";
} }
@@ -226,6 +226,10 @@ public:
static bool Run() { static bool Run() {
std::vector<std::string> failures, sucesses; std::vector<std::string> failures, sucesses;
TERMINAL_INFO
<< "Will run " << Instance().unitfunction_map_.size()
<< " test cases";
// Iterate all registered unit tests // Iterate all registered unit tests
for (auto& unit : Instance().unitfunction_map_) { for (auto& unit : Instance().unitfunction_map_) {
std::cout << MICROUNIT_SEPARATOR << std::endl; std::cout << MICROUNIT_SEPARATOR << std::endl;
@@ -238,7 +242,8 @@ public:
if (!result.success) { if (!result.success) {
TERMINAL_BAD << "Failed test"; TERMINAL_BAD << "Failed test";
failures.push_back(unit.first); failures.push_back(unit.first);
} else { }
else {
TERMINAL_GOOD << "Passed test"; TERMINAL_GOOD << "Passed test";
sucesses.push_back(unit.first); sucesses.push_back(unit.first);
} }
@@ -259,7 +264,8 @@ public:
TERMINAL_GOOD << "All tests passed"; TERMINAL_GOOD << "All tests passed";
std::cout << MICROUNIT_SEPARATOR << std::endl; std::cout << MICROUNIT_SEPARATOR << std::endl;
return true; return true;
} else { }
else {
TERMINAL_BAD << "Failed " << failures.size() TERMINAL_BAD << "Failed " << failures.size()
<< " test cases:"; << " test cases:";
for (const auto& failure : failures) { for (const auto& failure : failures) {