mirror of
https://github.com/alexkay/spek.git
synced 2025-04-22 03:10:29 +03:00
Add a function to run a test suite
This commit is contained in:
parent
e71dba7c88
commit
c96848edc1
@ -16,7 +16,7 @@
|
||||
* along with Spek. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <spek-utils.h>
|
||||
#include "spek-utils.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
@ -43,5 +43,5 @@ static void test_vercmp()
|
||||
|
||||
void test_utils()
|
||||
{
|
||||
test_vercmp();
|
||||
run(test_vercmp, "vercmp");
|
||||
}
|
||||
|
@ -37,6 +37,12 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
void run(std::function<void ()> func, const std::string& message)
|
||||
{
|
||||
std::cerr << message << std::endl;
|
||||
func();
|
||||
}
|
||||
|
||||
void test(const std::string& message, bool condition)
|
||||
{
|
||||
g_total++;
|
||||
|
@ -19,8 +19,10 @@
|
||||
#ifndef TEST_H_
|
||||
#define TEST_H_
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
void run(std::function<void ()> func, const std::string& message);
|
||||
void test(const std::string& message, bool condition);
|
||||
|
||||
template<class T> void test(const std::string& message, const T& expected, const T& actual)
|
||||
|
Loading…
x
Reference in New Issue
Block a user