Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference Hunting: tests/ thirdparty/ #273

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/core/io/test_config_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* test_config_file.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/* REDOT ENGINE */
/* https://redotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
Expand Down Expand Up @@ -47,7 +47,7 @@ TEST_CASE("[ConfigFile] Parsing well-formatted files") {
name = "Unnamed Player"
tagline="Waiting
for
Godot"
Redot"

color =Color( 0, 0.5,1, 1) ; Inline comment
position= Vector2(
Expand All @@ -68,7 +68,7 @@ antiAliasing = false
String(config_file.get_value("player", "name")) == "Unnamed Player",
"Reading `player/name` should return the expected value.");
CHECK_MESSAGE(
String(config_file.get_value("player", "tagline")) == "Waiting\nfor\nGodot",
String(config_file.get_value("player", "tagline")) == "Waiting\nfor\nRedot",
"Reading `player/tagline` should return the expected value.");
CHECK_MESSAGE(
Color(config_file.get_value("player", "color")).is_equal_approx(Color(0, 0.5, 1)),
Expand Down Expand Up @@ -96,7 +96,7 @@ TEST_CASE("[ConfigFile] Parsing malformatted file") {
[player]

name = "Unnamed Player"" ; Extraneous closing quote.
tagline = "Waiting\nfor\nGodot"
tagline = "Waiting\nfor\nRedot"

color = Color(0, 0.5, 1) ; Missing 4th parameter.
position = Vector2(
Expand All @@ -118,7 +118,7 @@ antialiasing = false ; Duplicate key.
TEST_CASE("[ConfigFile] Saving file") {
ConfigFile config_file;
config_file.set_value("player", "name", "Unnamed Player");
config_file.set_value("player", "tagline", "Waiting\nfor\nGodot");
config_file.set_value("player", "tagline", "Waiting\nfor\nRedot");
config_file.set_value("player", "color", Color(0, 0.5, 1));
config_file.set_value("player", "position", Vector2(3, 4));
config_file.set_value("graphics", "antialiasing", true);
Expand All @@ -140,7 +140,7 @@ TEST_CASE("[ConfigFile] Saving file") {
name="Unnamed Player"
tagline="Waiting
for
Godot"
Redot"
color=Color(0, 0.5, 1, 1)
position=Vector2(3, 4)

Expand Down
8 changes: 4 additions & 4 deletions tests/core/io/test_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* test_json.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/* REDOT ENGINE */
/* https://redotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
Expand Down Expand Up @@ -127,11 +127,11 @@ TEST_CASE("[JSON] Parsing arrays") {
TEST_CASE("[JSON] Parsing objects (dictionaries)") {
JSON json;

json.parse(R"({"name": "Godot Engine", "is_free": true, "bugs": null, "apples": {"red": 500, "green": 0, "blue": -20}, "empty_object": {}})");
json.parse(R"({"name": "Redot Engine", "is_free": true, "bugs": null, "apples": {"red": 500, "green": 0, "blue": -20}, "empty_object": {}})");

const Dictionary dictionary = json.get_data();
CHECK_MESSAGE(
dictionary["name"] == "Godot Engine",
dictionary["name"] == "Redot Engine",
"The parsed JSON should contain the expected values.");
CHECK_MESSAGE(
dictionary["is_free"],
Expand Down
6 changes: 3 additions & 3 deletions tests/core/io/test_marshalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* test_marshalls.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/* REDOT ENGINE */
/* https://redotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
Expand Down Expand Up @@ -141,7 +141,7 @@ TEST_CASE("[Marshalls] Floating point double precision decoding") {
}

TEST_CASE("[Marshalls] C string encoding") {
char cstring[] = "Godot"; // 5 characters
char cstring[] = "Redot"; // 5 characters
uint8_t data[6];

int actual_size = encode_cstring(cstring, data);
Expand Down
12 changes: 6 additions & 6 deletions tests/core/io/test_packet_peer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* test_packet_peer.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/* REDOT ENGINE */
/* https://redotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
Expand Down Expand Up @@ -68,7 +68,7 @@ TEST_CASE("[PacketPeer][PacketPeerStream] Encode buffer max size") {
}

TEST_CASE("[PacketPeer][PacketPeerStream] Read a variant from peer") {
String godot_rules = "Godot Rules!!!";
String godot_rules = "Redot Rules!!!";

Ref<StreamPeerBuffer> spb;
spb.instantiate();
Expand All @@ -95,7 +95,7 @@ TEST_CASE("[PacketPeer][PacketPeerStream] Read a variant from peer fails") {
}

TEST_CASE("[PacketPeer][PacketPeerStream] Put a variant to peer") {
String godot_rules = "Godot Rules!!!";
String godot_rules = "Redot Rules!!!";

Ref<StreamPeerBuffer> spb;
spb.instantiate();
Expand Down Expand Up @@ -127,7 +127,7 @@ TEST_CASE("[PacketPeer][PacketPeerStream] Put a variant to peer out of memory fa
}

TEST_CASE("[PacketPeer][PacketPeerStream] Get packet buffer") {
String godot_rules = "Godot Rules!!!";
String godot_rules = "Redot Rules!!!";

Ref<StreamPeerBuffer> spb;
spb.instantiate();
Expand Down Expand Up @@ -164,7 +164,7 @@ TEST_CASE("[PacketPeer][PacketPeerStream] Get packet buffer from an empty peer")
}

TEST_CASE("[PacketPeer][PacketPeerStream] Put packet buffer") {
String godot_rules = "Godot Rules!!!";
String godot_rules = "Redot Rules!!!";

Ref<StreamPeerBuffer> spb;
spb.instantiate();
Expand Down
6 changes: 3 additions & 3 deletions tests/core/math/test_quaternion.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* test_quaternion.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/* REDOT ENGINE */
/* https://redotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
Expand Down Expand Up @@ -292,7 +292,7 @@ TEST_CASE("[Quaternion] Product") {

// Test ZYX dynamic-axes since test data is available online.
// Rotate first about X axis, then new Y axis, then new Z axis.
// (Godot uses YXZ Yaw-Pitch-Roll order).
// (Redot uses YXZ Yaw-Pitch-Roll order).
Quaternion q_yp = q_y * q_p;
CHECK(q_yp[0] == doctest::Approx(0.239118));
CHECK(q_yp[1] == doctest::Approx(0.369644));
Expand Down
4 changes: 2 additions & 2 deletions tests/core/os/test_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* test_os.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) */
Expand Down
99 changes: 56 additions & 43 deletions tests/core/string/test_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* test_string.h */
/**************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/* REDOT ENGINE */
/* https://redotengine.org */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
Expand Down Expand Up @@ -285,9 +285,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")));

Expand All @@ -298,9 +298,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")));

Expand Down Expand Up @@ -1422,7 +1422,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;
Expand All @@ -1433,7 +1433,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;
Expand Down Expand Up @@ -1559,7 +1559,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";
Expand Down Expand Up @@ -1628,12 +1628,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++) {
Expand Down Expand Up @@ -1666,8 +1666,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 };
Expand Down Expand Up @@ -1794,20 +1794,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();
Expand Down Expand Up @@ -2007,38 +2019,39 @@ 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://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/ipv6", "https://", "fedc:ba98:7654:3210:fedc:ba98:7654:3210", 0, "/ipv6", "", 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.
CHECK_URL("google.com/#goto=http://redirect_url/", "", "google.com", 0, "/", "goto=http://redirect_url/", Error::OK);

// 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
}
Expand Down
Loading