- Basic RTTI type data with inheritance.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#define FENNEC_TEST_CONTAINERS_MAP_H
|
||||
|
||||
#include <fennec/containers/map.h>
|
||||
#include <fennec/langproc/strings/string.h>
|
||||
#include <fennec/lang/strings/string.h>
|
||||
|
||||
namespace fennec::test {
|
||||
|
||||
|
||||
@@ -53,6 +53,10 @@ inline void fennec_test_containers_rdtree() {
|
||||
assertf(next == rdtree<size_t>::npos || test.prev(next) == l, "Tree Construct Test Failed");
|
||||
}
|
||||
|
||||
tree_t insert;
|
||||
insert.insert(npos, 0, test);
|
||||
assertf(insert.size() == test.size(), "Tree Insert Tree Test Failed");
|
||||
|
||||
fennec_test_spacer(1);
|
||||
|
||||
test.erase(0);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef FENNEC_TEST_CONTAINERS_TUPLE_H
|
||||
#define FENNEC_TEST_CONTAINERS_TUPLE_H
|
||||
#include <fennec/containers/tuple.h>
|
||||
#include <fennec/langproc/strings/string.h>
|
||||
#include <fennec/lang/strings/string.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "../../../test.h"
|
||||
|
||||
#include <fennec/langproc/strings/cstring.h>
|
||||
#include <fennec/lang/strings/cstring.h>
|
||||
|
||||
namespace fennec::test
|
||||
{
|
||||
@@ -45,7 +45,6 @@ namespace fennec::test
|
||||
fennec_test_run(str.find("World"), static_cast<size_t>(6));
|
||||
fennec_test_run(str.rfind('o'), static_cast<size_t>(7));
|
||||
fennec_test_run(str.rfind("World"), static_cast<size_t>(6));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
57
test/tests/lang/strings/test_string.h
Normal file
57
test/tests/lang/strings/test_string.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// =====================================================================================================================
|
||||
// fennec, a free and open source game engine
|
||||
// Copyright © 2025 Medusa Slockbower
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
///
|
||||
/// \file test_string.h
|
||||
/// \brief
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
/// \author Medusa Slockbower
|
||||
///
|
||||
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||
///
|
||||
///
|
||||
|
||||
#ifndef FENNEC_TEST_LANGPROC_STRINGS_STRING_H
|
||||
#define FENNEC_TEST_LANGPROC_STRINGS_STRING_H
|
||||
|
||||
#include <fennec/lang/strings/string.h>
|
||||
|
||||
#include "../../../test.h"
|
||||
|
||||
namespace fennec::test
|
||||
{
|
||||
|
||||
inline void fennec_test_langproc_strings_string() {
|
||||
|
||||
string test0 = string("test0");
|
||||
string test1 = string("test1");
|
||||
|
||||
fennec_test_run(test0, test0);
|
||||
fennec_test_run(test1, test1);
|
||||
|
||||
fennec_test_spacer(1);
|
||||
|
||||
fennec_test_run(test1 = test0, test0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // FENNEC_TEST_LANGPROC_STRINGS_STRING_H
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#ifndef FENNEC_TEST_LANGPROC_FORMAT_H
|
||||
#define FENNEC_TEST_LANGPROC_FORMAT_H
|
||||
#include <fennec/langproc/strings/format.h>
|
||||
#include <fennec/lang/strings/format.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
#include "../../test.h"
|
||||
|
||||
#include <fennec/langproc/filesystem/file.h>
|
||||
#include <fennec/langproc/filesystem/path.h>
|
||||
#include <fennec/lang/filesystem/file.h>
|
||||
#include <fennec/lang/filesystem/path.h>
|
||||
|
||||
namespace fennec::test
|
||||
{
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "../../test.h"
|
||||
#include "./strings/test_cstring.h"
|
||||
#include "./strings/test_string.h"
|
||||
|
||||
namespace fennec::test
|
||||
{
|
||||
@@ -32,6 +33,12 @@ namespace fennec::test
|
||||
fennec_test_langproc_strings_cstring();
|
||||
fennec_test_spacer(3);
|
||||
|
||||
|
||||
fennec_test_subheader("string");
|
||||
fennec_test_spacer(2);
|
||||
fennec_test_langproc_strings_string();
|
||||
fennec_test_spacer(3);
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#ifndef FENNEC_TEST_LANG_BITS_H
|
||||
#define FENNEC_TEST_LANG_BITS_H
|
||||
|
||||
#include <fennec/lang/assert.h>
|
||||
#include <fennec/lang/bits.h>
|
||||
#include <fennec/langcpp/assert.h>
|
||||
#include <fennec/langcpp/bits.h>
|
||||
|
||||
#include "../../test.h"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef FENNEC_TEST_LANG_HASHING_H
|
||||
#define FENNEC_TEST_LANG_HASHING_H
|
||||
|
||||
#include <fennec/lang/hashing.h>
|
||||
#include <fennec/langcpp/hashing.h>
|
||||
#include "../../test.h"
|
||||
|
||||
namespace fennec::test
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef FENNEC_TEST_LANG_SEQUENCES_H
|
||||
#define FENNEC_TEST_LANG_SEQUENCES_H
|
||||
|
||||
#include <fennec/lang/const_sequences.h>
|
||||
#include <fennec/langcpp/const_sequences.h>
|
||||
|
||||
namespace fennec::test
|
||||
{
|
||||
@@ -19,9 +19,9 @@
|
||||
#ifndef FENNEC_TEST_LANG_H
|
||||
#define FENNEC_TEST_LANG_H
|
||||
|
||||
#include "lang/test_bits.h"
|
||||
#include "lang/test_conditional_types.h"
|
||||
#include "lang/test_hashing.h"
|
||||
#include "langcpp/test_bits.h"
|
||||
#include "langcpp/test_conditional_types.h"
|
||||
#include "langcpp/test_hashing.h"
|
||||
|
||||
namespace fennec::test
|
||||
{
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
|
||||
#include "../test.h"
|
||||
|
||||
#include "./langproc/test_strings.h"
|
||||
#include "./langproc/test_io.h"
|
||||
#include "langproc/test_format.h"
|
||||
#include "./lang/test_strings.h"
|
||||
#include "./lang/test_io.h"
|
||||
#include "lang/test_format.h"
|
||||
|
||||
namespace fennec::test
|
||||
{
|
||||
|
||||
67
test/tests/test_rtti.h
Normal file
67
test/tests/test_rtti.h
Normal file
@@ -0,0 +1,67 @@
|
||||
// =====================================================================================================================
|
||||
// fennec, a free and open source game engine
|
||||
// Copyright © 2025 Medusa Slockbower
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
///
|
||||
/// \file test_rtti.h
|
||||
/// \brief
|
||||
///
|
||||
///
|
||||
/// \details
|
||||
/// \author Medusa Slockbower
|
||||
///
|
||||
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||
///
|
||||
///
|
||||
|
||||
#ifndef FENNEC_TEST_RTTI_H
|
||||
#define FENNEC_TEST_RTTI_H
|
||||
|
||||
#include <fennec/lang/strings/string.h>
|
||||
#include <fennec/rtti/type.h>
|
||||
#include <fennec/rtti/type_data.h>
|
||||
#include <fennec/rtti/detail/_type_name.h>
|
||||
#include <fennec/scene/node2d.h>
|
||||
|
||||
#include "../test.h"
|
||||
|
||||
|
||||
namespace fennec::test
|
||||
{
|
||||
|
||||
struct rtti_test_base {
|
||||
FENNEC_RTTI_ENABLE();
|
||||
};
|
||||
|
||||
struct rtti_test_sub : rtti_test_base {
|
||||
FENNEC_RTTI_ENABLE(rtti_test_base);
|
||||
};
|
||||
|
||||
inline void fennec_test_rtti() {
|
||||
|
||||
fennec_test_run(string(detail::type_name<int>()), string("int"));
|
||||
fennec_test_run(type::get<int>(), type::get<signed int>());
|
||||
|
||||
fennec_test_run(type::get<rtti_test_sub>().name(), string(detail::type_name<rtti_test_sub>()));
|
||||
fennec_test_run(type::get<rtti_test_sub>().supertypes()[0].name(), string(detail::type_name<rtti_test_base>()));
|
||||
fennec_test_run(type::get<rtti_test_base>().subtypes()[0].name(), string(detail::type_name<rtti_test_sub>()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // FENNEC_TEST_RTTI_H
|
||||
Reference in New Issue
Block a user