Use Catch2 macros. (#382)

This commit is contained in:
Branimir Karadžić
2026-04-09 20:43:51 -07:00
committed by GitHub
parent d54d89d6b5
commit c6131ec676
11 changed files with 57 additions and 57 deletions

View File

@@ -671,7 +671,7 @@ TEST_CASE("FixedStringT", "[string]")
REQUIRE(0 == strCmp(fs64, "13899831") );
}
TEST(tinystl_string_constructor)
TEST_CASE("tinystl_string_constructor", "[tinystl]")
{
using tinystl::string;
{
@@ -705,7 +705,7 @@ TEST(tinystl_string_constructor)
}
}
TEST(tinystl_string_assign)
TEST_CASE("tinystl_string_assign", "[tinystl]")
{
using tinystl::string;
{
@@ -763,7 +763,7 @@ TEST(tinystl_string_assign)
}
}
bool testFormatHumanNumber(bx::StringView _expected, double _value, int32_t _numFrac, int32_t _bufferSize = 32)
bool testFormatHumanNumber(bx::StringView _expected, double _value, uint8_t _numFrac, int32_t _bufferSize = 32)
{
char* tmp = (char*)BX_STACK_ALLOC(_bufferSize);
int32_t total = bx::formatHumanNumber(tmp, _bufferSize, _value, _numFrac);

View File

@@ -33,7 +33,7 @@ namespace {
struct Foo { int bar; };
}
TEST(uomap_nonpod_compiles) {
TEST_CASE("uomap_nonpod_compiles", "[tinystl]") {
// verify this compiles
typedef tinystl::unordered_map<int, Foo> map;

View File

@@ -42,7 +42,7 @@ static void comparemaps(const tinystl::unordered_map<K, V>& m, const tinystl::un
}
}
TEST(uomap_constructor) {
TEST_CASE("uomap_constructor", "[tinystl]") {
typedef tinystl::unordered_map<int, int> unordered_map;
using tinystl::make_pair;
@@ -79,7 +79,7 @@ TEST(uomap_constructor) {
}
}
TEST(uomap_assign) {
TEST_CASE("uomap_assign", "[tinystl]") {
typedef tinystl::unordered_map<int, int> unordered_map;
using tinystl::make_pair;
@@ -132,7 +132,7 @@ TEST(uomap_assign) {
}
}
TEST(uomap_insert) {
TEST_CASE("uomap_insert", "[tinystl]") {
using tinystl::string;
using tinystl::pair;
typedef tinystl::unordered_map<string, string> unordered_map;
@@ -187,7 +187,7 @@ TEST(uomap_insert) {
}
}
TEST(uomap_iterate) {
TEST_CASE("uomap_iterate", "[tinystl]") {
typedef tinystl::unordered_map<size_t, size_t> unordered_map;
{
unordered_map m;

View File

@@ -29,7 +29,7 @@
#include <tinystl/allocator.h>
#include <tinystl/unordered_set.h>
TEST(uoset_copyctor) {
TEST_CASE("uoset_copyctor", "") {
// verify this compiles
typedef tinystl::unordered_set<unsigned int> set;

View File

@@ -29,7 +29,7 @@
#include <tinystl/allocator.h>
#include <tinystl/unordered_set.h>
TEST(uoset_pod_compiles) {
TEST_CASE("uoset_pod_compiles", "") {
// verify this compiles
tinystl::unordered_set<unsigned int> s;

View File

@@ -40,7 +40,7 @@ static void comparesets(const tinystl::unordered_set<T>& s, const tinystl::unord
}
}
TEST(uoset_constructor) {
TEST_CASE("uoset_constructor", "[tinystl]") {
typedef tinystl::unordered_set<int> unordered_set;
unordered_set baseline;
@@ -74,7 +74,7 @@ TEST(uoset_constructor) {
}
}
TEST(uoset_assign) {
TEST_CASE("uoset_assign", "[tinystl]") {
typedef tinystl::unordered_set<int> unordered_set;
unordered_set baseline;
@@ -124,7 +124,7 @@ TEST(uoset_assign) {
}
}
TEST(uoset_insert) {
TEST_CASE("uoset_insert", "[tinystl]") {
typedef tinystl::unordered_set<tinystl::string> unordered_set;
typedef tinystl::pair<unordered_set::iterator, bool> pair;
@@ -173,7 +173,7 @@ TEST(uoset_insert) {
}
}
TEST(uoset_iterate) {
TEST_CASE("uoset_iterate", "[tinystl]") {
typedef tinystl::unordered_set<int> unordered_set;
{
unordered_set s;

View File

@@ -58,7 +58,7 @@ static inline bool operator==(const complex& lhs, const complex& rhs) {
return false;
}
TEST(vector_complex_constructor) {
TEST_CASE("vector_complex_constructor", "[tinystl]") {
typedef tinystl::vector<complex> vector;
{
@@ -103,7 +103,7 @@ TEST(vector_complex_constructor) {
}
}
TEST(vector_complex_assignment) {
TEST_CASE("vector_complex_assignment", "[tinystl]") {
typedef tinystl::vector<complex> vector;
{
@@ -120,7 +120,7 @@ TEST(vector_complex_assignment) {
}
}
TEST(vector_complex_pushback) {
TEST_CASE("vector_complex_pushback", "[tinystl]") {
tinystl::vector<complex> v;
v.push_back("42");
@@ -128,7 +128,7 @@ TEST(vector_complex_pushback) {
CHECK(v[0] == "42");
}
TEST(vector_complex_vector) {
TEST_CASE("vector_complex_vector", "[tinystl]") {
tinystl::vector< tinystl::vector<complex> > v(10, tinystl::vector<complex>());
tinystl::vector< tinystl::vector<complex> >::iterator it = v.begin(), end = v.end();
@@ -139,7 +139,7 @@ TEST(vector_complex_vector) {
}
}
TEST(vector_complex_swap) {
TEST_CASE("vector_complex_swap", "[tinystl]") {
tinystl::vector<complex> v1;
v1.push_back("12");
v1.push_back("20");
@@ -156,7 +156,7 @@ TEST(vector_complex_swap) {
CHECK(v2[1] == "20");
}
TEST(vector_complex_popback) {
TEST_CASE("vector_complex_popback", "[tinystl]") {
tinystl::vector<complex> v;
v.push_back("12");
v.push_back("24");
@@ -169,7 +169,7 @@ TEST(vector_complex_popback) {
CHECK(v.size() == 1);
}
TEST(vector_complex_assign) {
TEST_CASE("vector_complex_assign", "[tinystl]") {
tinystl::vector<complex> v;
CHECK(v.size() == 0);
@@ -180,7 +180,7 @@ TEST(vector_complex_assign) {
CHECK( std::equal(v.begin(), v.end(), array) );
}
TEST(vector_complex_erase) {
TEST_CASE("vector_complex_erase", "[tinystl]") {
const complex array[10] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
tinystl::vector<complex> v(array, array + 10);
@@ -200,7 +200,7 @@ TEST(vector_complex_erase) {
CHECK(v[1] == "9");
}
TEST(vector_complex_erase_unordered) {
TEST_CASE("vector_complex_erase_unordered", "[tinystl]") {
const complex array[10] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
typedef tinystl::vector<complex> vector;
vector v(array, array + 10);
@@ -231,7 +231,7 @@ TEST(vector_complex_erase_unordered) {
CHECK( std::count(v.begin(), v.end(), last) == 1 );
}
TEST(vector_complex_insert) {
TEST_CASE("vector_complex_insert", "[tinystl]") {
const complex array[10] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
tinystl::vector<complex> v(array, array + 10);
@@ -253,7 +253,7 @@ TEST(vector_complex_insert) {
CHECK( std::equal(v.begin(), v.end(), finalarray) );
}
TEST(vector_complex_iterator) {
TEST_CASE("vector_complex_iterator", "[tinystl]") {
const complex array[10] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
tinystl::vector<complex> v(array, array + 10);

View File

@@ -64,7 +64,7 @@ static inline bool operator==(const nocopy& lhs, const nocopy& rhs) {
return false;
}
TEST(vector_nocopy_constructor) {
TEST_CASE("vector_nocopy_constructor", "[tinystl]") {
typedef tinystl::vector<nocopy> vector;
{
@@ -81,7 +81,7 @@ TEST(vector_nocopy_constructor) {
}
}
TEST(vector_nocopy_pushback) {
TEST_CASE("vector_nocopy_pushback", "[tinystl]") {
tinystl::vector<nocopy> v;
v.emplace_back("42");
v.emplace_back();
@@ -92,7 +92,7 @@ TEST(vector_nocopy_pushback) {
CHECK( v[1] == "24" );
}
TEST(vector_nocopy_vector) {
TEST_CASE("vector_nocopy_vector", "[tinystl]") {
tinystl::vector< tinystl::vector<nocopy> > v(10);
tinystl::vector< tinystl::vector<nocopy> >::iterator it = v.begin(), end = v.end();
@@ -103,7 +103,7 @@ TEST(vector_nocopy_vector) {
}
}
TEST(vector_nocopy_swap) {
TEST_CASE("vector_nocopy_swap", "[tinystl]") {
tinystl::vector<nocopy> v1;
v1.emplace_back("12");
v1.emplace_back("20");
@@ -120,7 +120,7 @@ TEST(vector_nocopy_swap) {
CHECK(v2[1] == "20");
}
TEST(vector_nocopy_popback) {
TEST_CASE("vector_nocopy_popback", "[tinystl]") {
tinystl::vector<nocopy> v;
v.emplace_back("12");
v.emplace_back("24");
@@ -133,7 +133,7 @@ TEST(vector_nocopy_popback) {
CHECK(v.size() == 1);
}
TEST(vector_nocopy_erase) {
TEST_CASE("vector_nocopy_erase", "[tinystl]") {
tinystl::vector<nocopy> v;
v.emplace_back("1");
v.emplace_back("2");
@@ -155,7 +155,7 @@ TEST(vector_nocopy_erase) {
CHECK(v[1] == "4");
}
TEST(vector_nocopy_erase_unordered) {
TEST_CASE("vector_nocopy_erase_unordered", "[tinystl]") {
typedef tinystl::vector<nocopy> vector;
vector v;
v.emplace_back("1");
@@ -190,7 +190,7 @@ TEST(vector_nocopy_erase_unordered) {
CHECK( std::count(v.begin(), v.end(), last) == 1 );
}
TEST(vector_nocopy_insert) {
TEST_CASE("vector_nocopy_insert", "[tinystl]") {
tinystl::vector<nocopy> v;
v.emplace_back("1");
v.emplace_back("2");
@@ -210,7 +210,7 @@ TEST(vector_nocopy_insert) {
CHECK( v.back() == "6" );
}
TEST(vector_nocopy_iterator) {
TEST_CASE("vector_nocopy_iterator", "[tinystl]") {
tinystl::vector<nocopy> v(5);
v[0].reset("1");
v[1].reset("2");

View File

@@ -57,7 +57,7 @@ static inline bool operator==(const nodefault& lhs, const nodefault& rhs) {
return false;
}
TEST(vector_nodefault_constructor) {
TEST_CASE("vector_nodefault_constructor", "[tinystl]") {
typedef tinystl::vector<nodefault> vector;
{
@@ -93,7 +93,7 @@ TEST(vector_nodefault_constructor) {
}
}
TEST(vector_nodefault_assignment) {
TEST_CASE("vector_nodefault_assignment", "[tinystl]") {
typedef tinystl::vector<nodefault> vector;
{
@@ -110,7 +110,7 @@ TEST(vector_nodefault_assignment) {
}
}
TEST(vector_nodefault_pushback) {
TEST_CASE("vector_nodefault_pushback", "[tinystl]") {
tinystl::vector<nodefault> v;
v.push_back("42");
@@ -118,7 +118,7 @@ TEST(vector_nodefault_pushback) {
CHECK(v[0] == "42");
}
TEST(vector_nodefault_vector) {
TEST_CASE("vector_nodefault_vector", "[tinystl]") {
tinystl::vector< tinystl::vector<nodefault> > v(10, tinystl::vector<nodefault>());
tinystl::vector< tinystl::vector<nodefault> >::iterator it = v.begin(), end = v.end();
@@ -129,7 +129,7 @@ TEST(vector_nodefault_vector) {
}
}
TEST(vector_nodefault_swap) {
TEST_CASE("vector_nodefault_swap", "[tinystl]") {
tinystl::vector<nodefault> v1;
v1.push_back("12");
v1.push_back("20");
@@ -146,7 +146,7 @@ TEST(vector_nodefault_swap) {
CHECK(v2[1] == "20");
}
TEST(vector_nodefault_popback) {
TEST_CASE("vector_nodefault_popback", "[tinystl]") {
tinystl::vector<nodefault> v;
v.push_back("12");
v.push_back("24");
@@ -159,7 +159,7 @@ TEST(vector_nodefault_popback) {
CHECK(v.size() == 1);
}
TEST(vector_nodefault_assign) {
TEST_CASE("vector_nodefault_assign", "[tinystl]") {
tinystl::vector<nodefault> v;
CHECK(v.size() == 0);
@@ -170,7 +170,7 @@ TEST(vector_nodefault_assign) {
CHECK( std::equal(v.begin(), v.end(), array) );
}
TEST(vector_nodefault_erase) {
TEST_CASE("vector_nodefault_erase", "[tinystl]") {
const nodefault array[10] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
tinystl::vector<nodefault> v(array, array + 10);
@@ -190,7 +190,7 @@ TEST(vector_nodefault_erase) {
CHECK(v[1] == "9");
}
TEST(vector_nodefault_erase_unordered) {
TEST_CASE("vector_nodefault_erase_unordered", "[tinystl]") {
const nodefault array[10] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
typedef tinystl::vector<nodefault> vector;
vector v(array, array + 10);
@@ -221,7 +221,7 @@ TEST(vector_nodefault_erase_unordered) {
CHECK( std::count(v.begin(), v.end(), last) == 1 );
}
TEST(vector_nodefault_insert) {
TEST_CASE("vector_nodefault_insert", "[tinystl]") {
const nodefault array[10] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
tinystl::vector<nodefault> v(array, array + 10);
@@ -243,7 +243,7 @@ TEST(vector_nodefault_insert) {
CHECK( std::equal(v.begin(), v.end(), finalarray) );
}
TEST(vector_nodefault_iterator) {
TEST_CASE("vector_nodefault_iterator", "[tinystl]") {
const nodefault array[10] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
tinystl::vector<nodefault> v(array, array + 10);

View File

@@ -31,7 +31,7 @@
#include <algorithm>
TEST(vector_constructor) {
TEST_CASE("vector_constructor", "[tinystl]") {
typedef tinystl::vector<int> vector;
{
@@ -76,7 +76,7 @@ TEST(vector_constructor) {
}
}
TEST(vector_assignment) {
TEST_CASE("vector_assignment", "[tinystl]") {
typedef tinystl::vector<int> vector;
{
@@ -93,7 +93,7 @@ TEST(vector_assignment) {
}
}
TEST(vector_pushback) {
TEST_CASE("vector_pushback", "[tinystl]") {
tinystl::vector<int> v;
v.push_back(42);
@@ -101,7 +101,7 @@ TEST(vector_pushback) {
CHECK(v[0] == 42);
}
TEST(vector_vector) {
TEST_CASE("vector_vector", "[tinystl]") {
tinystl::vector< tinystl::vector<int> > v(10, tinystl::vector<int>());
tinystl::vector< tinystl::vector<int> >::iterator it = v.begin(), end = v.end();
@@ -112,7 +112,7 @@ TEST(vector_vector) {
}
}
TEST(vector_swap) {
TEST_CASE("vector_swap", "[tinystl]") {
tinystl::vector<int> v1;
v1.push_back(12);
v1.push_back(20);
@@ -129,7 +129,7 @@ TEST(vector_swap) {
CHECK(v2[1] == 20);
}
TEST(vector_popback) {
TEST_CASE("vector_popback", "[tinystl]") {
tinystl::vector<int> v;
v.push_back(12);
v.push_back(24);
@@ -142,7 +142,7 @@ TEST(vector_popback) {
CHECK(v.size() == 1);
}
TEST(vector_assign) {
TEST_CASE("vector_assign", "[tinystl]") {
tinystl::vector<int> v;
CHECK(v.size() == 0);
@@ -153,7 +153,7 @@ TEST(vector_assign) {
CHECK( std::equal(v.begin(), v.end(), array) );
}
TEST(vector_erase) {
TEST_CASE("vector_erase", "[tinystl]") {
const int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
tinystl::vector<int> v(array, array + 10);
@@ -173,7 +173,7 @@ TEST(vector_erase) {
CHECK(v[1] == 9);
}
TEST(vector_erase_unordered) {
TEST_CASE("vector_erase_unordered", "[tinystl]") {
const int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
typedef tinystl::vector<int> vector;
vector v(array, array + 10);
@@ -204,7 +204,7 @@ TEST(vector_erase_unordered) {
CHECK( std::count(v.begin(), v.end(), last) == 1 );
}
TEST(vector_insert) {
TEST_CASE("vector_insert", "[tinystl]") {
const int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
tinystl::vector<int> v(array, array + 10);
@@ -226,7 +226,7 @@ TEST(vector_insert) {
CHECK( std::equal(v.begin(), v.end(), finalarray) );
}
TEST(vector_iterator) {
TEST_CASE("vector_iterator", "[tinystl]") {
const int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
tinystl::vector<int> v(array, array + 10);

View File

@@ -29,7 +29,7 @@
#include <tinystl/allocator.h>
#include <tinystl/vector.h>
TEST(vector_shrinktofit) {
TEST_CASE("vector_shrinktofit", "[tinystl]") {
typedef tinystl::vector<int> vector;
{