Updated catch.

This commit is contained in:
Branimir Karadžić
2017-02-20 19:48:16 -08:00
parent e760d0aa9d
commit 97eba92e96
10 changed files with 1102 additions and 505 deletions

1566
3rdparty/catch/catch.hpp vendored

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,7 @@
#include <stdlib.h> // size_t
#include <stddef.h> // ptrdiff_t
#include "platform.h"
#include "config.h"
#include "macros.h"

View File

@@ -6,7 +6,7 @@
#ifndef BX_CONFIG_H_HEADER_GUARD
#define BX_CONFIG_H_HEADER_GUARD
#include "platform.h"
#include "bx.h"
#ifndef BX_CONFIG_ALLOCATOR_DEBUG
# define BX_CONFIG_ALLOCATOR_DEBUG 0

View File

@@ -6,7 +6,6 @@
#ifndef BX_ERROR_H_HEADER_GUARD
#define BX_ERROR_H_HEADER_GUARD
#include "bx.h"
#include "string.h"
#define BX_ERROR_SET(_ptr, _result, _msg) \

View File

@@ -6,7 +6,6 @@
#ifndef BX_OS_H_HEADER_GUARD
#define BX_OS_H_HEADER_GUARD
#include "bx.h"
#include "debug.h"
#if BX_PLATFORM_OSX

View File

@@ -6,7 +6,6 @@
#ifndef BX_READERWRITER_H_HEADER_GUARD
#define BX_READERWRITER_H_HEADER_GUARD
#include "bx.h"
#include "allocator.h"
#include "error.h"
#include "uint32_t.h"

View File

@@ -6,11 +6,10 @@
#ifndef BX_STRING_H_HEADER_GUARD
#define BX_STRING_H_HEADER_GUARD
#include "bx.h"
#include <wchar.h> // wchar_t
#include "allocator.h"
#include <wchar.h> // wchar_t
namespace bx
{
/// Non-zero-terminated string view.
@@ -179,7 +178,7 @@ namespace bx
// Finds identifier.
const char* findIdentifierMatch(const char* _str, const char* _word);
// Finds any identifier from NULL terminated array of identifiers.
/// Finds any identifier from NULL terminated array of identifiers.
const char* findIdentifierMatch(const char* _str, const char* _words[]);
/// Cross platform implementation of vsnprintf that returns number of

View File

@@ -3,16 +3,11 @@
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
#define CATCH_CONFIG_RUNNER
#include "test.h"
static const char* s_argv[] = { "bx.test" };
int runAllTests(int _argc, const char* _argv[])
{
DBG(BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME);
return Catch::Session().run(_argc, _argv);
}
int runAllTests(int _argc, const char* _argv[]);
#if BX_PLATFORM_ANDROID
# include <android/native_activity.h>

20
tests/run_test.cpp Normal file
View File

@@ -0,0 +1,20 @@
/*
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
*/
#define CATCH_CONFIG_RUNNER
#include "test.h"
int runAllTests(int _argc, const char* _argv[])
{
DBG("Compiler: " BX_COMPILER_NAME
", CPU: " BX_CPU_NAME
", Architecture: " BX_ARCH_NAME
", OS: " BX_PLATFORM_NAME
", CRT: " BX_CRT_NAME
", Date: " __DATE__
", Time: " __TIME__
);
return Catch::Session().run(_argc, _argv);
}

View File

@@ -7,6 +7,7 @@
#define __TEST_H__
#include <bx/bx.h>
#include <catch/catch.hpp>
#define TEST(_x) TEST_CASE(#_x, "")
#define CHECK_EQUAL(_x, _y) REQUIRE(_x == _y)