summaryrefslogtreecommitdiffstats
path: root/tests/core/string/test_string.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core/string/test_string.h')
-rw-r--r--tests/core/string/test_string.h99
1 files changed, 57 insertions, 42 deletions
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h
index 9adc97e845..fd9b43a677 100644
--- a/tests/core/string/test_string.h
+++ b/tests/core/string/test_string.h
@@ -2,9 +2,11 @@
/* test_string.h */
/**************************************************************************/
/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
+/* REDOT ENGINE */
+/* https://redotengine.org */
/**************************************************************************/
+/* Copyright (c) 2024-present Redot Engine contributors */
+/* (see REDOT_AUTHORS.md) */
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
@@ -285,9 +287,9 @@ TEST_CASE("[String] Testing for empty string") {
}
TEST_CASE("[String] Contains") {
- String s = "C:\\Godot\\project\\string_test.tscn";
+ String s = "C:\\Redot\\project\\string_test.tscn";
CHECK(s.contains(":\\"));
- CHECK(s.contains("Godot"));
+ CHECK(s.contains("Redot"));
CHECK(s.contains(String("project\\string_test")));
CHECK(s.contains(String("\\string_test.tscn")));
@@ -298,9 +300,9 @@ TEST_CASE("[String] Contains") {
}
TEST_CASE("[String] Contains case insensitive") {
- String s = "C:\\Godot\\project\\string_test.tscn";
- CHECK(s.containsn("Godot"));
- CHECK(s.containsn("godot"));
+ String s = "C:\\Redot\\project\\string_test.tscn";
+ CHECK(s.containsn("Redot"));
+ CHECK(s.containsn("Redot"));
CHECK(s.containsn(String("Project\\string_test")));
CHECK(s.containsn(String("\\string_Test.tscn")));
@@ -1457,7 +1459,7 @@ TEST_CASE("[String] Checking string is empty when it should be") {
if (!success) {
state = false;
}
- String b = "Godot";
+ String b = "Redot";
success = b[b.size()] == 0;
if (!success) {
state = false;
@@ -1468,7 +1470,7 @@ TEST_CASE("[String] Checking string is empty when it should be") {
state = false;
}
- const String d = "Godot";
+ const String d = "Redot";
success = d[d.size()] == 0;
if (!success) {
state = false;
@@ -1594,7 +1596,7 @@ TEST_CASE("[String] Count and countn functionality") {
s = "TestTestTest";
MULTICHECK_STRING_EQ(s, count, "TestTest", 1);
- s = "TestGodotTestGodotTestGodot";
+ s = "TestRedotTestRedotTestRedot";
MULTICHECK_STRING_EQ(s, count, "Test", 3);
s = "TestTestTestTest";
@@ -1663,12 +1665,12 @@ TEST_CASE("[String] dedent") {
}
TEST_CASE("[String] Path functions") {
- static const char *path[8] = { "C:\\Godot\\project\\test.tscn", "/Godot/project/test.xscn", "../Godot/project/test.scn", "Godot\\test.doc", "C:\\test.", "res://test", "user://test", "/.test" };
- static const char *base_dir[8] = { "C:\\Godot\\project", "/Godot/project", "../Godot/project", "Godot", "C:\\", "res://", "user://", "/" };
- static const char *base_name[8] = { "C:\\Godot\\project\\test", "/Godot/project/test", "../Godot/project/test", "Godot\\test", "C:\\test", "res://test", "user://test", "/" };
+ static const char *path[8] = { "C:\\Redot\\project\\test.tscn", "/Redot/project/test.xscn", "../Redot/project/test.scn", "Redot\\test.doc", "C:\\test.", "res://test", "user://test", "/.test" };
+ static const char *base_dir[8] = { "C:\\Redot\\project", "/Redot/project", "../Redot/project", "Redot", "C:\\", "res://", "user://", "/" };
+ static const char *base_name[8] = { "C:\\Redot\\project\\test", "/Redot/project/test", "../Redot/project/test", "Redot\\test", "C:\\test", "res://test", "user://test", "/" };
static const char *ext[8] = { "tscn", "xscn", "scn", "doc", "", "", "", "test" };
static const char *file[8] = { "test.tscn", "test.xscn", "test.scn", "test.doc", "test.", "test", "test", ".test" };
- static const char *simplified[8] = { "C:/Godot/project/test.tscn", "/Godot/project/test.xscn", "../Godot/project/test.scn", "Godot/test.doc", "C:/test.", "res://test", "user://test", "/.test" };
+ static const char *simplified[8] = { "C:/Redot/project/test.tscn", "/Redot/project/test.xscn", "../Redot/project/test.scn", "Redot/test.doc", "C:/test.", "res://test", "user://test", "/.test" };
static const bool abs[8] = { true, true, false, false, true, true, true, true };
for (int i = 0; i < 8; i++) {
@@ -1701,8 +1703,8 @@ TEST_CASE("[String] hash") {
}
TEST_CASE("[String] uri_encode/unescape") {
- String s = "Godot Engine:'docs'";
- String t = "Godot%20Engine%3A%27docs%27";
+ String s = "Redot Engine:'docs'";
+ String t = "Redot%20Engine%3A%27docs%27";
String x1 = "T%C4%93%C5%A1t";
static const uint8_t u8str[] = { 0x54, 0xC4, 0x93, 0xC5, 0xA1, 0x74, 0x00 };
@@ -1829,20 +1831,32 @@ TEST_CASE("[String] Reverse") {
}
TEST_CASE("[String] SHA1/SHA256/MD5") {
- String s = "Godot";
- String sha1 = "a1e91f39b9fce6a9998b14bdbe2aa2b39dc2d201";
+ String s = "Redot";
+ String sha1 = "fa4e7bc6eda6baf3600e392f46be46f699bd5a8a";
static uint8_t sha1_buf[20] = {
- 0xA1, 0xE9, 0x1F, 0x39, 0xB9, 0xFC, 0xE6, 0xA9, 0x99, 0x8B, 0x14, 0xBD, 0xBE, 0x2A, 0xA2, 0xB3,
- 0x9D, 0xC2, 0xD2, 0x01
+ 0xFA, 0x4E, 0x7B, 0xC6,
+ 0xED, 0xA6, 0xBA, 0xF3,
+ 0x60, 0x0E, 0x39, 0x2F,
+ 0x46, 0xBE, 0x46, 0xF6,
+ 0x99, 0xBD, 0x5A, 0x8A
};
- String sha256 = "2a02b2443f7985d89d09001086ae3dcfa6eb0f55c6ef170715d42328e16e6cb8";
+ String sha256 = "5b33770f1e60d19c83ba6be484306fa1fcf5266e6ee8de2f4456483e92327c1a";
static uint8_t sha256_buf[32] = {
- 0x2A, 0x02, 0xB2, 0x44, 0x3F, 0x79, 0x85, 0xD8, 0x9D, 0x09, 0x00, 0x10, 0x86, 0xAE, 0x3D, 0xCF,
- 0xA6, 0xEB, 0x0F, 0x55, 0xC6, 0xEF, 0x17, 0x07, 0x15, 0xD4, 0x23, 0x28, 0xE1, 0x6E, 0x6C, 0xB8
+ 0x5B, 0x33, 0x77, 0x0F,
+ 0x1E, 0x60, 0xD1, 0x9C,
+ 0x83, 0xBA, 0x6B, 0xE4,
+ 0x84, 0x30, 0x6F, 0xA1,
+ 0xFC, 0xF5, 0x26, 0x6E,
+ 0x6E, 0xE8, 0xDE, 0x2F,
+ 0x44, 0x56, 0x48, 0x3E,
+ 0x92, 0x32, 0x7C, 0x1A
};
- String md5 = "4a336d087aeb0390da10ee2ea7cb87f8";
+ String md5 = "a417866a47d1710210ed143c47ad5e4d";
static uint8_t md5_buf[16] = {
- 0x4A, 0x33, 0x6D, 0x08, 0x7A, 0xEB, 0x03, 0x90, 0xDA, 0x10, 0xEE, 0x2E, 0xA7, 0xCB, 0x87, 0xF8
+ 0xA4, 0x17, 0x86, 0x6A,
+ 0x47, 0xD1, 0x71, 0x02,
+ 0x10, 0xED, 0x14, 0x3C,
+ 0x47, 0xAD, 0x5E, 0x4D
};
PackedByteArray buf = s.sha1_buffer();
@@ -2042,18 +2056,19 @@ TEST_CASE("[String][URL] Parse URL") {
CHECK_URL("https://www.example.com:8080/path/to/file.html#fragment", "https://", "www.example.com", 8080, "/path/to/file.html", "fragment", Error::OK);
// Valid URLs.
- CHECK_URL("https://godotengine.org", "https://", "godotengine.org", 0, "", "", Error::OK);
- CHECK_URL("https://godotengine.org/", "https://", "godotengine.org", 0, "/", "", Error::OK);
- CHECK_URL("godotengine.org/", "", "godotengine.org", 0, "/", "", Error::OK);
- CHECK_URL("HTTPS://godotengine.org/", "https://", "godotengine.org", 0, "/", "", Error::OK);
- CHECK_URL("https://GODOTENGINE.ORG/", "https://", "godotengine.org", 0, "/", "", Error::OK);
- CHECK_URL("http://godotengine.org", "http://", "godotengine.org", 0, "", "", Error::OK);
- CHECK_URL("https://godotengine.org:8080", "https://", "godotengine.org", 8080, "", "", Error::OK);
- CHECK_URL("https://godotengine.org/blog", "https://", "godotengine.org", 0, "/blog", "", Error::OK);
- CHECK_URL("https://godotengine.org/blog/", "https://", "godotengine.org", 0, "/blog/", "", Error::OK);
- CHECK_URL("https://docs.godotengine.org/en/stable", "https://", "docs.godotengine.org", 0, "/en/stable", "", Error::OK);
- CHECK_URL("https://docs.godotengine.org/en/stable/", "https://", "docs.godotengine.org", 0, "/en/stable/", "", Error::OK);
- CHECK_URL("https://me:secret@godotengine.org", "https://", "godotengine.org", 0, "", "", Error::OK);
+ CHECK_URL("https://redotengine.org", "https://", "redotengine.org", 0, "", "", Error::OK);
+ CHECK_URL("https://redotengine.org/", "https://", "redotengine.org", 0, "/", "", Error::OK);
+ CHECK_URL("redotengine.org/", "", "redotengine.org", 0, "/", "", Error::OK);
+ CHECK_URL("HTTPS://redotengine.org/", "https://", "redotengine.org", 0, "/", "", Error::OK);
+ CHECK_URL("https://REDOTENGINE.ORG/", "https://", "redotengine.org", 0, "/", "", Error::OK);
+ CHECK_URL("http://redotengine.org", "http://", "redotengine.org", 0, "", "", Error::OK);
+ CHECK_URL("https://redotengine.org:8080", "https://", "redotengine.org", 8080, "", "", Error::OK);
+ CHECK_URL("https://redotengine.org/blog", "https://", "redotengine.org", 0, "/blog", "", Error::OK);
+ CHECK_URL("https://redotengine.org/blog/", "https://", "redotengine.org", 0, "/blog/", "", Error::OK);
+ CHECK_URL("https://docs.redotengine.org/en/stable", "https://", "docs.redotengine.org", 0, "/en/stable", "", Error::OK);
+ CHECK_URL("https://docs.redotengine.org/en/stable/", "https://", "docs.redotengine.org", 0, "/en/stable/", "", Error::OK);
+ CHECK_URL("https://me:secret@redotengine.org", "https://", "redotengine.org", 0, "", "", Error::OK);
+ // TODO: ADD redotengine.org ipv6"
CHECK_URL("https://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/ipv6", "https://", "fedc:ba98:7654:3210:fedc:ba98:7654:3210", 0, "/ipv6", "", Error::OK);
// Scheme vs Fragment.
@@ -2062,18 +2077,18 @@ TEST_CASE("[String][URL] Parse URL") {
// Invalid URLs.
// Invalid Scheme.
- CHECK_URL("https_://godotengine.org", "", "https_", 0, "//godotengine.org", "", Error::ERR_INVALID_PARAMETER);
+ CHECK_URL("https_://redotengine.org", "", "https_", 0, "//redotengine.org", "", Error::ERR_INVALID_PARAMETER);
// Multiple ports.
- CHECK_URL("https://godotengine.org:8080:433", "https://", "", 0, "", "", Error::ERR_INVALID_PARAMETER);
+ CHECK_URL("https://redotengine.org:8080:433", "https://", "", 0, "", "", Error::ERR_INVALID_PARAMETER);
// Missing ] on literal IPv6.
CHECK_URL("https://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/ipv6", "https://", "", 0, "/ipv6", "", Error::ERR_INVALID_PARAMETER);
// Missing host.
CHECK_URL("https:///blog", "https://", "", 0, "/blog", "", Error::ERR_INVALID_PARAMETER);
// Invalid ports.
- CHECK_URL("https://godotengine.org:notaport", "https://", "godotengine.org", 0, "", "", Error::ERR_INVALID_PARAMETER);
- CHECK_URL("https://godotengine.org:-8080", "https://", "godotengine.org", -8080, "", "", Error::ERR_INVALID_PARAMETER);
- CHECK_URL("https://godotengine.org:88888", "https://", "godotengine.org", 88888, "", "", Error::ERR_INVALID_PARAMETER);
+ CHECK_URL("https://redotengine.org:notaport", "https://", "redotengine.org", 0, "", "", Error::ERR_INVALID_PARAMETER);
+ CHECK_URL("https://redotengine.org:-8080", "https://", "redotengine.org", -8080, "", "", Error::ERR_INVALID_PARAMETER);
+ CHECK_URL("https://redotengine.org:88888", "https://", "redotengine.org", 88888, "", "", Error::ERR_INVALID_PARAMETER);
#undef CHECK_URL
}