mirror of
https://github.com/davidalbertonogueira/MLP.git
synced 2025-12-18 04:44:39 +03:00
Update microunit test.
This commit is contained in:
14
deps/microunit.h
vendored
14
deps/microunit.h
vendored
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* @file microunit.h
|
||||
* @version 0.1
|
||||
* @author Sebastiao Salvador de Miranda (ssm)
|
||||
* @brief Tiny library for cpp unit testing. Should work on any c++11 compiler.
|
||||
*
|
||||
@@ -59,7 +60,6 @@
|
||||
#ifndef _MICROUNIT_MICROUNIT_H_
|
||||
#define _MICROUNIT_MICROUNIT_H_
|
||||
#include <string.h>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -224,7 +224,7 @@ public:
|
||||
* @returns True if all tests pass, false otherwise.
|
||||
*/
|
||||
static bool Run() {
|
||||
std::vector<std::string> failures;
|
||||
std::vector<std::string> failures, sucesses;
|
||||
|
||||
// Iterate all registered unit tests
|
||||
for (auto& unit : Instance().unitfunction_map_) {
|
||||
@@ -240,12 +240,20 @@ public:
|
||||
failures.push_back(unit.first);
|
||||
} else {
|
||||
TERMINAL_GOOD << "Passed test";
|
||||
sucesses.push_back(unit.first);
|
||||
}
|
||||
}
|
||||
std::cout
|
||||
<< MICROUNIT_SEPARATOR << std::endl
|
||||
<< MICROUNIT_SEPARATOR << std::endl;
|
||||
|
||||
TERMINAL_GOOD << "Passed " << sucesses.size()
|
||||
<< " test cases:";
|
||||
for (const auto& success_t : sucesses) {
|
||||
TERMINAL_GOOD << success_t;
|
||||
}
|
||||
std::cout << MICROUNIT_SEPARATOR << std::endl;
|
||||
|
||||
// Output result summary
|
||||
if (failures.empty()) {
|
||||
TERMINAL_GOOD << "All tests passed";
|
||||
@@ -303,7 +311,7 @@ private:
|
||||
static UnitTester instance;
|
||||
return instance;
|
||||
}
|
||||
std::unordered_map<std::string, UnitFunction> unitfunction_map_;
|
||||
std::map<std::string, UnitFunction> unitfunction_map_;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user