This commit is contained in:
Spartan322
2025-06-20 02:38:24 -04:00
699 changed files with 21288 additions and 9565 deletions

View File

@@ -386,13 +386,8 @@ TEST_CASE("[Resource] Duplication") {
INFO(std::string(String(orig->get_class_name()).utf8().get_data()));
orig->call("set_defaults");
const Ref<Resource> &dupe = p_duplicate_fn(orig);
if ((p_test_mode == TEST_MODE_RESOURCE_DUPLICATE_DEEP_WITH_MODE || p_test_mode == TEST_MODE_VARIANT_DUPLICATE_DEEP_WITH_MODE) && p_deep_mode == RESOURCE_DEEP_DUPLICATE_MAX) {
CHECK(dupe.is_null());
} else {
dupe->call("verify_duplication", orig, p_test_mode, p_deep_mode);
}
dupe->call("verify_duplication", orig, p_test_mode, p_deep_mode);
}
};
@@ -416,7 +411,7 @@ TEST_CASE("[Resource] Duplication") {
SUBCASE("Resource::duplicate_deep()") {
static int deep_mode = 0;
for (deep_mode = 0; deep_mode <= RESOURCE_DEEP_DUPLICATE_MAX; deep_mode++) {
for (deep_mode = 0; deep_mode < RESOURCE_DEEP_DUPLICATE_MAX; deep_mode++) {
_run_test(
TEST_MODE_RESOURCE_DUPLICATE_DEEP_WITH_MODE,
(ResourceDeepDuplicateMode)deep_mode,
@@ -469,7 +464,7 @@ TEST_CASE("[Resource] Duplication") {
SUBCASE("Variant::duplicate_deep()") {
static int deep_mode = 0;
for (deep_mode = 0; deep_mode <= RESOURCE_DEEP_DUPLICATE_MAX; deep_mode++) {
for (deep_mode = 0; deep_mode < RESOURCE_DEEP_DUPLICATE_MAX; deep_mode++) {
_run_test(
TEST_MODE_VARIANT_DUPLICATE_DEEP_WITH_MODE,
(ResourceDeepDuplicateMode)deep_mode,

View File

@@ -240,4 +240,20 @@ TEST_CASE("[HashSet] Copy") {
}
}
TEST_CASE("[HashSet] Equality") {
// Empty sets.
CHECK(HashSet<int>{} == HashSet<int>{});
CHECK(HashSet<int>{} != HashSet<int>{ 1, 2, 3 });
CHECK(HashSet<int>{ 1, 2, 3 } != HashSet<int>{});
// Different length.
CHECK(HashSet<int>{ 1, 2, 3 } != HashSet<int>{ 1, 2, 3, 4 });
CHECK(HashSet<int>{ 1, 2, 3, 4 } != HashSet<int>{ 4, 3, 2 });
// Same length.
CHECK(HashSet<int>{ 1, 2, 3 } == HashSet<int>{ 1, 2, 3 });
CHECK(HashSet<int>{ 1, 2, 3 } == HashSet<int>{ 3, 2, 1 });
CHECK(HashSet<int>{ 1, 2, 3 } != HashSet<int>{ 1, 2, 8 });
}
} // namespace TestHashSet

View File

@@ -45,10 +45,10 @@ TEST_CASE("[Span] Constexpr Validators") {
static_assert(span_empty.is_empty());
constexpr static uint16_t value = 5;
constexpr Span<uint16_t> span_value(&value, 1);
static_assert(span_value.ptr() == &value);
static_assert(span_value.size() == 1);
static_assert(!span_value.is_empty());
Span<uint16_t> span_value(&value, 1);
CHECK(span_value.ptr() == &value);
CHECK(span_value.size() == 1);
CHECK(!span_value.is_empty());
static constexpr int ints[] = { 0, 1, 2, 3, 4, 5 };
constexpr Span<int> span_array = ints;

View File

@@ -60,7 +60,7 @@ bool is_operator_char(unsigned char c) {
String remove_spaces(String &p_str) {
String res;
// Result is guaranteed to not be longer than the input.
res.resize(p_str.size());
res.resize_uninitialized(p_str.size());
int wp = 0;
char32_t last = 0;
bool has_removed = false;
@@ -84,7 +84,7 @@ String remove_spaces(String &p_str) {
last = c;
}
}
res.resize(wp);
res.resize_uninitialized(wp);
return res;
}

View File

@@ -604,6 +604,7 @@ TEST_SUITE("[Navigation2D]") {
navigation_polygon->add_outline(PackedVector2Array({ Vector2(-1000.0, -1000.0), Vector2(1000.0, -1000.0), Vector2(1000.0, 1000.0), Vector2(-1000.0, 1000.0) }));
navigation_server->map_set_active(map, true);
navigation_server->map_set_use_async_iterations(map, false);
navigation_server->region_set_use_async_iterations(region, false);
navigation_server->region_set_map(region, map);
navigation_server->region_set_navigation_polygon(region, navigation_polygon);
navigation_server->physics_process(0.0); // Give server some cycles to commit.
@@ -661,6 +662,7 @@ TEST_SUITE("[Navigation2D]") {
RID region = navigation_server->region_create();
navigation_server->map_set_active(map, true);
navigation_server->map_set_use_async_iterations(map, false);
navigation_server->region_set_use_async_iterations(region, false);
navigation_server->region_set_map(region, map);
navigation_server->region_set_navigation_polygon(region, navigation_polygon);
navigation_server->physics_process(0.0); // Give server some cycles to commit.