billboard example error fix + string wrapper first implementation

This commit is contained in:
Metehan Tuncbilek
2024-10-16 11:57:05 +03:00
parent 42c94cd05d
commit 5256ef8ff3
3 changed files with 161 additions and 1 deletions

89
tests/StringTest.cpp Normal file
View File

@@ -0,0 +1,89 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <catch2/catch_all.hpp>
#include "Data/Containers/String.hpp"
using namespace OpenVulkano;
TEST_CASE("String")
{
SECTION("Constructors")
{
String str1;
REQUIRE(str1 == "");
String str2("Hello");
REQUIRE(str2 == "Hello");
String str3(std::string("World"));
REQUIRE(str3 == "World");
String str4(str2);
REQUIRE(str4 == "Hello");
String str5(std::move(str3));
REQUIRE(str5 == "World");
}
SECTION("Assignment")
{
String str1;
str1 = "Hello";
REQUIRE(str1 == "Hello");
String str2;
str2 = std::string("World");
REQUIRE(str2 == "World");
String str3;
str3 = str1;
REQUIRE(str3 == "Hello");
String str4;
str4 = std::move(str2);
REQUIRE(str4 == "World");
}
SECTION("Concatenation")
{
String str1("Hello");
str1 += " World";
REQUIRE(str1 == "Hello World");
String str2("Hello");
String str3 = str2 + " World";
REQUIRE(str3 == "Hello World");
String str4("Hello");
str4 += std::string(" World");
REQUIRE(str4 == "Hello World");
String str5("Hello");
String str6 = str5 + std::string(" World");
REQUIRE(str6 == "Hello World");
String str7("Hello");
str7 += String(" World");
REQUIRE(str7 == "Hello World");
String str8("Hello");
String str9 = str8 + String(" World");
REQUIRE(str9 == "Hello World");
}
SECTION("Comparison")
{
String str1("Hello");
REQUIRE(str1 == "Hello");
REQUIRE(str1 != "World");
String str2("World");
REQUIRE(str2 == "World");
REQUIRE(str2 != "Hello");
}
}