summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp64
-rw-r--r--main/main.h1
-rw-r--r--main/performance.cpp6
-rw-r--r--main/performance.h1
-rw-r--r--main/tests/test_gdscript.cpp94
-rw-r--r--main/tests/test_gui.cpp4
-rw-r--r--main/tests/test_main.cpp18
-rw-r--r--main/tests/test_math.cpp26
-rw-r--r--main/tests/test_oa_hash_map.cpp2
-rw-r--r--main/tests/test_ordered_hash_map.cpp1
-rw-r--r--main/tests/test_physics_2d.cpp31
-rw-r--r--main/tests/test_physics_3d.cpp27
-rw-r--r--main/tests/test_render.cpp8
-rw-r--r--main/tests/test_shader_lang.cpp24
-rw-r--r--main/tests/test_string.cpp32
15 files changed, 0 insertions, 339 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 958d964b35..ef632e197c 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -205,7 +205,6 @@ void initialize_physics() {
}
void finalize_physics() {
-
physics_server->finish();
memdelete(physics_server);
@@ -214,7 +213,6 @@ void finalize_physics() {
}
void finalize_display() {
-
rendering_server->finish();
memdelete(rendering_server);
@@ -244,7 +242,6 @@ void finalize_navigation_server() {
#endif
void Main::print_help(const char *p_binary) {
-
print_line(String(VERSION_NAME) + " v" + get_full_version_string() + " - " + String(VERSION_WEBSITE));
OS::get_singleton()->print("Free and open source software under the terms of the MIT license.\n");
OS::get_singleton()->print("(c) 2007-2020 Juan Linietsky, Ariel Manzur.\n");
@@ -390,7 +387,6 @@ void Main::print_help(const char *p_binary) {
*/
Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_phase) {
-
OS::get_singleton()->initialize();
engine = memnew(Engine);
@@ -425,7 +421,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
List<String> main_args;
for (int i = 0; i < argc; i++) {
-
args.push_back(String::utf8(argv[i]));
}
@@ -434,7 +429,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
I = args.front();
while (I) {
-
I->get() = unescape_cmdline(I->get().strip_edges());
I = I->next();
}
@@ -498,7 +492,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
goto error;
} else if (I->get() == "--version") {
-
print_line(get_full_version_string());
goto error;
@@ -512,7 +505,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--audio-driver") { // audio driver
if (I->next()) {
-
audio_driver = I->next()->get();
bool found = false;
@@ -549,7 +541,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--display-driver") { // force video driver
if (I->next()) {
-
display_driver = I->next()->get();
bool found = false;
@@ -598,7 +589,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Engine::singleton->abort_on_gpu_errors = true;
} else if (I->get() == "--disable-wintab") {
-
disable_wintab = true;
} else if (I->get() == "--single-window") { // force single window
@@ -609,7 +599,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--resolution") { // force resolution
if (I->next()) {
-
String vm = I->next()->get();
if (vm.find("x") == -1) { // invalid parameter format
@@ -622,7 +611,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
int h = vm.get_slice("x", 1).to_int();
if (w <= 0 || h <= 0) {
-
OS::get_singleton()->print("Invalid resolution '%s', width and height must be above 0.\n", vm.utf8().get_data());
goto error;
}
@@ -640,7 +628,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--position") { // set window position
if (I->next()) {
-
String vm = I->next()->get();
if (vm.find(",") == -1) { // invalid parameter format
@@ -668,11 +655,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->set_no_window_mode(true);
} else if (I->get() == "--enable-vsync-via-compositor") {
-
window_vsync_via_compositor = true;
saw_vsync_via_compositor_override = true;
} else if (I->get() == "--disable-vsync-via-compositor") {
-
window_vsync_via_compositor = false;
saw_vsync_via_compositor_override = true;
#endif
@@ -683,7 +668,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "-l" || I->get() == "--language") { // language
if (I->next()) {
-
locale = I->next()->get();
N = I->next()->next();
} else {
@@ -694,7 +678,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--remote-fs") { // remote filesystem
if (I->next()) {
-
remotefs = I->next()->get();
N = I->next()->next();
} else {
@@ -704,7 +687,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--remote-fs-password") { // remote filesystem password
if (I->next()) {
-
remotefs_pass = I->next()->get();
N = I->next()->next();
} else {
@@ -714,7 +696,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--render-thread") { // render thread mode
if (I->next()) {
-
if (I->next()->get() == "safe")
rtm = OS::RENDER_THREAD_SAFE;
else if (I->next()->get() == "unsafe")
@@ -754,7 +735,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--path") { // set path of project to start or edit
if (I->next()) {
-
String p = I->next()->get();
if (OS::get_singleton()->set_cwd(p) == OK) {
//nothing
@@ -790,7 +770,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "-b" || I->get() == "--breakpoints") { // add breakpoints
if (I->next()) {
-
String bplist = I->next()->get();
breakpoints = bplist.split(",");
N = I->next()->next();
@@ -802,7 +781,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--frame-delay") { // force frame delay
if (I->next()) {
-
frame_delay = I->next()->get().to_int();
N = I->next()->next();
} else {
@@ -813,7 +791,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--time-scale") { // force time scale
if (I->next()) {
-
Engine::get_singleton()->set_time_scale(I->next()->get().to_double());
N = I->next()->next();
} else {
@@ -822,9 +799,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
} else if (I->get() == "--main-pack") {
-
if (I->next()) {
-
main_pack = I->next()->get();
N = I->next()->next();
} else {
@@ -842,7 +817,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#endif
} else if (I->get() == "--remote-debug") {
if (I->next()) {
-
debug_uri = I->next()->get();
if (debug_uri.find("://") == -1) { // wrong address
OS::get_singleton()->print("Invalid debug host address, it should be of the form <protocol>://<host/IP>:<port>.\n");
@@ -855,7 +829,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
} else if (I->get() == "--allow_focus_steal_pid") { // not exposed to user
if (I->next()) {
-
allow_focus_steal_pid = I->next()->get().to_int64();
N = I->next()->next();
} else {
@@ -896,7 +869,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// 'project.godot' file which will only be available through the network if this is enabled
FileAccessNetwork::configure();
if (remotefs != "") {
-
file_access_network_client = memnew(FileAccessNetworkClient);
int port;
if (remotefs.find(":") != -1) {
@@ -920,7 +892,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
found_project = true;
#endif
} else {
-
#ifdef TOOLS_ENABLED
editor = false;
#else
@@ -1033,13 +1004,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
ProjectSettings::get_singleton()->set_custom_property_info("display/window/size/test_height", PropertyInfo(Variant::INT, "display/window/size/test_height", PROPERTY_HINT_RANGE, "0,4320,or_greater")); // 8K resolution
if (use_custom_res) {
-
if (!force_res) {
window_size.width = GLOBAL_GET("display/window/size/width");
window_size.height = GLOBAL_GET("display/window/size/height");
if (globals->has_setting("display/window/size/test_width") && globals->has_setting("display/window/size/test_height")) {
-
int tw = globals->get("display/window/size/test_width");
if (tw > 0) {
window_size.width = tw;
@@ -1119,9 +1088,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
/* Determine audio and video drivers */
for (int i = 0; i < DisplayServer::get_create_function_count(); i++) {
-
if (display_driver == DisplayServer::get_create_function_name(i)) {
-
display_driver_idx = i;
break;
}
@@ -1136,9 +1103,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) {
-
if (audio_driver == AudioDriverManager::get_driver(i)->get_name()) {
-
audio_driver_idx = i;
break;
}
@@ -1243,7 +1208,6 @@ error:
}
Error Main::setup2(Thread::ID p_main_tid_override) {
-
preregister_module_types();
preregister_server_types();
@@ -1265,7 +1229,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
/* Iniitalize Display Server */
{
-
String rendering_driver; // temp broken
Error err;
@@ -1417,7 +1380,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
Input *id = Input::get_singleton();
if (id) {
if (bool(GLOBAL_DEF("input_devices/pointing/emulate_touch_from_mouse", false)) && !(editor || project_manager)) {
-
bool found_touchscreen = false;
for (int i = 0; i < DisplayServer::get_singleton()->get_screen_count(); i++) {
if (DisplayServer::get_singleton()->screen_is_touchscreen(i)) {
@@ -1445,7 +1407,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
ProjectSettings::get_singleton()->set_custom_property_info("display/mouse_cursor/custom_image", PropertyInfo(Variant::STRING, "display/mouse_cursor/custom_image", PROPERTY_HINT_FILE, "*.png,*.webp"));
if (String(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image")) != String()) {
-
Ref<Texture2D> cursor = ResourceLoader::load(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image"));
if (cursor.is_valid()) {
Vector2 hotspot = ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image_hotspot");
@@ -1480,7 +1441,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
translation_server->setup(); //register translations, load them, etc.
if (locale != "") {
-
translation_server->set_locale(locale);
}
translation_server->load_translations();
@@ -1520,7 +1480,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
static MainTimerSync main_timer_sync;
bool Main::start() {
-
ERR_FAIL_COND_V(!_start_success, false);
bool hasicon = false;
@@ -1604,7 +1563,6 @@ bool Main::start() {
String main_loop_type;
#ifdef TOOLS_ENABLED
if (doc_tool != "") {
-
Engine::get_singleton()->set_editor_hint(true); // Needed to instance editor-only classes for their default values
{
@@ -1700,7 +1658,6 @@ bool Main::start() {
#endif
} else if (script != "") {
-
Ref<Script> script_res = ResourceLoader::load(script);
ERR_FAIL_COND_V_MSG(script_res.is_null(), false, "Can't load script: " + script);
@@ -1712,7 +1669,6 @@ bool Main::start() {
}
if (script_res->can_instance()) {
-
StringName instance_type = script_res->get_instance_base_type();
Object *obj = ClassDB::instance(instance_type);
MainLoop *script_loop = Object::cast_to<MainLoop>(obj);
@@ -1725,7 +1681,6 @@ bool Main::start() {
script_loop->set_init_script(script_res);
main_loop = script_loop;
} else {
-
return false;
}
@@ -1741,13 +1696,11 @@ bool Main::start() {
DisplayServer::get_singleton()->alert("Error: MainLoop type doesn't exist: " + main_loop_type);
return false;
} else {
-
Object *ml = ClassDB::instance(main_loop_type);
ERR_FAIL_COND_V_MSG(!ml, false, "Can't instance MainLoop type.");
main_loop = Object::cast_to<MainLoop>(ml);
if (!main_loop) {
-
memdelete(ml);
ERR_FAIL_V_MSG(false, "Invalid MainLoop type.");
}
@@ -1755,7 +1708,6 @@ bool Main::start() {
}
if (main_loop->is_class("SceneTree")) {
-
SceneTree *sml = Object::cast_to<SceneTree>(main_loop);
#ifdef DEBUG_ENABLED
@@ -1783,7 +1735,6 @@ bool Main::start() {
//first pass, add the constants so they exist before any script is loaded
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
-
String s = E->get().name;
if (!s.begins_with("autoload/"))
continue;
@@ -1804,7 +1755,6 @@ bool Main::start() {
//second pass, load into global constants
List<Node *> to_add;
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
-
String s = E->get().name;
if (!s.begins_with("autoload/"))
continue;
@@ -1850,7 +1800,6 @@ bool Main::start() {
}
for (List<Node *>::Element *E = to_add.front(); E; E = E->next()) {
-
sml->get_root()->add_child(E->get());
}
}
@@ -1870,7 +1819,6 @@ bool Main::start() {
#endif
{
-
int directional_atlas_size = GLOBAL_GET("rendering/quality/directional_shadow/size");
RenderingServer::get_singleton()->directional_shadow_atlas_set_size(directional_atlas_size);
}
@@ -1932,7 +1880,6 @@ bool Main::start() {
sml->get_root()->set_default_canvas_item_texture_repeat(Viewport::DefaultCanvasItemTextureRepeat(texture_repeat));
} else {
-
GLOBAL_DEF("display/window/stretch/mode", "disabled");
ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport"));
GLOBAL_DEF("display/window/stretch/aspect", "ignore");
@@ -1952,16 +1899,13 @@ bool Main::start() {
String local_game_path;
if (game_path != "" && !project_manager) {
-
local_game_path = game_path.replace("\\", "/");
if (!local_game_path.begins_with("res://")) {
bool absolute = (local_game_path.size() > 1) && (local_game_path[0] == '/' || local_game_path[1] == ':');
if (!absolute) {
-
if (ProjectSettings::get_singleton()->is_using_datapack()) {
-
local_game_path = "res://" + local_game_path;
} else {
@@ -1972,7 +1916,6 @@ bool Main::start() {
local_game_path = da->get_current_dir().plus_file(local_game_path);
memdelete(da);
} else {
-
DirAccess *da = DirAccess::open(local_game_path.substr(0, sep));
if (da) {
local_game_path = da->get_current_dir().plus_file(local_game_path.substr(sep + 1, local_game_path.length()));
@@ -1987,7 +1930,6 @@ bool Main::start() {
#ifdef TOOLS_ENABLED
if (editor) {
-
bool editor_embed_subwindows = EditorSettings::get_singleton()->get_setting("interface/editor/single_window_mode");
if (editor_embed_subwindows) {
@@ -2051,7 +1993,6 @@ bool Main::start() {
#ifdef TOOLS_ENABLED
if (project_manager || (script == "" && test == "" && game_path == "" && !editor)) {
-
Engine::get_singleton()->set_editor_hint(true);
ProjectManager *pmanager = memnew(ProjectManager);
ProgressDialog *progress_dialog = memnew(ProgressDialog);
@@ -2109,7 +2050,6 @@ static uint64_t physics_process_max = 0;
static uint64_t idle_process_max = 0;
bool Main::iteration() {
-
//for now do not error on this
//ERR_FAIL_COND_V(iterating, false);
@@ -2152,7 +2092,6 @@ bool Main::iteration() {
Engine::get_singleton()->_in_physics = true;
for (int iters = 0; iters < advance.physics_steps; ++iters) {
-
uint64_t physics_begin = OS::get_singleton()->get_ticks_usec();
PhysicsServer3D::get_singleton()->sync();
@@ -2194,7 +2133,6 @@ bool Main::iteration() {
RenderingServer::get_singleton()->sync(); //sync if still drawing from previous frames.
if (DisplayServer::get_singleton()->can_any_window_draw() && !disable_render_loop) {
-
if ((!force_redraw_requested) && OS::get_singleton()->is_in_low_processor_usage_mode()) {
if (RenderingServer::get_singleton()->has_changed()) {
RenderingServer::get_singleton()->draw(true, scaled_step); // flush visual commands
@@ -2224,7 +2162,6 @@ bool Main::iteration() {
Engine::get_singleton()->_idle_frames++;
if (frame > 1000000) {
-
if (editor || project_manager) {
if (print_fps) {
print_line("Editor FPS: " + itos(frames));
@@ -2294,7 +2231,6 @@ void Main::force_redraw() {
* The order matters as some of those steps are linked with each other.
*/
void Main::cleanup() {
-
ERR_FAIL_COND(!_start_success);
EngineDebugger::deinitialize();
diff --git a/main/main.h b/main/main.h
index e8f8357518..ab6917a65c 100644
--- a/main/main.h
+++ b/main/main.h
@@ -36,7 +36,6 @@
#include "core/typedefs.h"
class Main {
-
static void print_help(const char *p_binary);
static uint64_t last_ticks;
static uint64_t target_ticks;
diff --git a/main/performance.cpp b/main/performance.cpp
index 3de2cba125..0894d68d3c 100644
--- a/main/performance.cpp
+++ b/main/performance.cpp
@@ -42,7 +42,6 @@
Performance *Performance::singleton = nullptr;
void Performance::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("get_monitor", "monitor"), &Performance::get_monitor);
BIND_ENUM_CONSTANT(TIME_FPS);
@@ -85,7 +84,6 @@ float Performance::_get_node_count() const {
}
String Performance::get_monitor_name(Monitor p_monitor) const {
-
ERR_FAIL_INDEX_V(p_monitor, MONITOR_MAX, String());
static const char *names[MONITOR_MAX] = {
@@ -123,7 +121,6 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
}
float Performance::get_monitor(Monitor p_monitor) const {
-
switch (p_monitor) {
case TIME_FPS:
return Engine::get_singleton()->get_frames_per_second();
@@ -226,17 +223,14 @@ Performance::MonitorType Performance::get_monitor_type(Monitor p_monitor) const
}
void Performance::set_process_time(float p_pt) {
-
_process_time = p_pt;
}
void Performance::set_physics_process_time(float p_pt) {
-
_physics_process_time = p_pt;
}
Performance::Performance() {
-
_process_time = 0;
_physics_process_time = 0;
singleton = this;
diff --git a/main/performance.h b/main/performance.h
index c0f6044ea0..ddbe45fa00 100644
--- a/main/performance.h
+++ b/main/performance.h
@@ -37,7 +37,6 @@
#define PERF_WARN_PROCESS_SYNC
class Performance : public Object {
-
GDCLASS(Performance, Object);
static Performance *singleton;
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp
index 971460c655..d95be7b218 100644
--- a/main/tests/test_gdscript.cpp
+++ b/main/tests/test_gdscript.cpp
@@ -45,7 +45,6 @@
namespace TestGDScript {
static void _print_indent(int p_ident, const String &p_text) {
-
String txt;
for (int i = 0; i < p_ident; i++) {
txt += '\t';
@@ -55,7 +54,6 @@ static void _print_indent(int p_ident, const String &p_text) {
}
static String _parser_extends(const GDScriptParser::ClassNode *p_class) {
-
String txt = "extends ";
if (String(p_class->extends_file) != "") {
txt += "\"" + p_class->extends_file + "\"";
@@ -64,7 +62,6 @@ static String _parser_extends(const GDScriptParser::ClassNode *p_class) {
}
for (int i = 0; i < p_class->extends_class.size(); i++) {
-
if (i != 0)
txt += ".";
@@ -75,12 +72,9 @@ static String _parser_extends(const GDScriptParser::ClassNode *p_class) {
}
static String _parser_expr(const GDScriptParser::Node *p_expr) {
-
String txt;
switch (p_expr->type) {
-
case GDScriptParser::Node::TYPE_IDENTIFIER: {
-
const GDScriptParser::IdentifierNode *id_node = static_cast<const GDScriptParser::IdentifierNode *>(p_expr);
txt = id_node->name;
} break;
@@ -99,7 +93,6 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
const GDScriptParser::ArrayNode *arr_node = static_cast<const GDScriptParser::ArrayNode *>(p_expr);
txt += "[";
for (int i = 0; i < arr_node->elements.size(); i++) {
-
if (i > 0)
txt += ", ";
txt += _parser_expr(arr_node->elements[i]);
@@ -110,7 +103,6 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
const GDScriptParser::DictionaryNode *dict_node = static_cast<const GDScriptParser::DictionaryNode *>(p_expr);
txt += "{";
for (int i = 0; i < dict_node->elements.size(); i++) {
-
if (i > 0)
txt += ", ";
@@ -122,31 +114,25 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
txt += "}";
} break;
case GDScriptParser::Node::TYPE_OPERATOR: {
-
const GDScriptParser::OperatorNode *c_node = static_cast<const GDScriptParser::OperatorNode *>(p_expr);
switch (c_node->op) {
-
case GDScriptParser::OperatorNode::OP_PARENT_CALL:
txt += ".";
[[fallthrough]];
case GDScriptParser::OperatorNode::OP_CALL: {
-
ERR_FAIL_COND_V(c_node->arguments.size() < 1, "");
String func_name;
const GDScriptParser::Node *nfunc = c_node->arguments[0];
int arg_ofs = 0;
if (nfunc->type == GDScriptParser::Node::TYPE_BUILT_IN_FUNCTION) {
-
const GDScriptParser::BuiltInFunctionNode *bif_node = static_cast<const GDScriptParser::BuiltInFunctionNode *>(nfunc);
func_name = GDScriptFunctions::get_func_name(bif_node->function);
arg_ofs = 1;
} else if (nfunc->type == GDScriptParser::Node::TYPE_TYPE) {
-
const GDScriptParser::TypeNode *t_node = static_cast<const GDScriptParser::TypeNode *>(nfunc);
func_name = Variant::get_type_name(t_node->vtype);
arg_ofs = 1;
} else {
-
ERR_FAIL_COND_V(c_node->arguments.size() < 2, "");
nfunc = c_node->arguments[1];
ERR_FAIL_COND_V(nfunc->type != GDScriptParser::Node::TYPE_IDENTIFIER, "");
@@ -161,7 +147,6 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
txt += func_name + "(";
for (int i = arg_ofs; i < c_node->arguments.size(); i++) {
-
const GDScriptParser::Node *arg = c_node->arguments[i];
if (i > arg_ofs)
txt += ", ";
@@ -172,7 +157,6 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
} break;
case GDScriptParser::OperatorNode::OP_INDEX: {
-
ERR_FAIL_COND_V(c_node->arguments.size() != 2, "");
//index with []
@@ -180,7 +164,6 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
} break;
case GDScriptParser::OperatorNode::OP_INDEX_NAMED: {
-
ERR_FAIL_COND_V(c_node->arguments.size() != 2, "");
txt = _parser_expr(c_node->arguments[0]) + "." + _parser_expr(c_node->arguments[1]);
@@ -296,11 +279,9 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
} break;
case GDScriptParser::Node::TYPE_NEWLINE: {
-
//skippie
} break;
default: {
-
ERR_FAIL_V_MSG("", "Parser bug at " + itos(p_expr->line) + ", invalid expression type: " + itos(p_expr->type));
}
}
@@ -309,20 +290,14 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
}
static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_indent) {
-
for (int i = 0; i < p_block->statements.size(); i++) {
-
const GDScriptParser::Node *statement = p_block->statements[i];
switch (statement->type) {
-
case GDScriptParser::Node::TYPE_CONTROL_FLOW: {
-
const GDScriptParser::ControlFlowNode *cf_node = static_cast<const GDScriptParser::ControlFlowNode *>(statement);
switch (cf_node->cf_type) {
-
case GDScriptParser::ControlFlowNode::CF_IF: {
-
ERR_FAIL_COND(cf_node->arguments.size() != 1);
String txt;
txt += "if ";
@@ -351,7 +326,6 @@ static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_i
} break;
case GDScriptParser::ControlFlowNode::CF_WHILE: {
-
ERR_FAIL_COND(cf_node->arguments.size() != 1);
String txt;
txt += "while ";
@@ -366,15 +340,12 @@ static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_i
// FIXME: Implement
} break;
case GDScriptParser::ControlFlowNode::CF_CONTINUE: {
-
_print_indent(p_indent, "continue");
} break;
case GDScriptParser::ControlFlowNode::CF_BREAK: {
-
_print_indent(p_indent, "break");
} break;
case GDScriptParser::ControlFlowNode::CF_RETURN: {
-
if (cf_node->arguments.size())
_print_indent(p_indent, "return " + _parser_expr(cf_node->arguments[0]));
else
@@ -384,7 +355,6 @@ static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_i
} break;
case GDScriptParser::Node::TYPE_LOCAL_VAR: {
-
const GDScriptParser::LocalVarNode *lv_node = static_cast<const GDScriptParser::LocalVarNode *>(statement);
_print_indent(p_indent, "var " + String(lv_node->name));
} break;
@@ -397,7 +367,6 @@ static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_i
}
static void _parser_show_function(const GDScriptParser::FunctionNode *p_func, int p_indent, GDScriptParser::BlockNode *p_initializer = nullptr) {
-
String txt;
if (p_func->_static)
txt = "static ";
@@ -409,7 +378,6 @@ static void _parser_show_function(const GDScriptParser::FunctionNode *p_func, in
txt += "(";
for (int i = 0; i < p_func->arguments.size(); i++) {
-
if (i != 0)
txt += ", ";
txt += "var " + String(p_func->arguments[i]);
@@ -433,15 +401,12 @@ static void _parser_show_function(const GDScriptParser::FunctionNode *p_func, in
}
static void _parser_show_class(const GDScriptParser::ClassNode *p_class, int p_indent, const Vector<String> &p_code) {
-
if (p_indent == 0 && (String(p_class->extends_file) != "" || p_class->extends_class.size())) {
-
_print_indent(p_indent, _parser_extends(p_class));
print_line("\n");
}
for (int i = 0; i < p_class->subclasses.size(); i++) {
-
const GDScriptParser::ClassNode *subclass = p_class->subclasses[i];
String line = "class " + subclass->name;
if (String(subclass->extends_file) != "" || subclass->extends_class.size())
@@ -458,7 +423,6 @@ static void _parser_show_class(const GDScriptParser::ClassNode *p_class, int p_i
}
for (int i = 0; i < p_class->variables.size(); i++) {
-
const GDScriptParser::ClassNode::Member &m = p_class->variables[i];
_print_indent(p_indent, "var " + String(m.identifier));
@@ -467,13 +431,11 @@ static void _parser_show_class(const GDScriptParser::ClassNode *p_class, int p_i
print_line("\n");
for (int i = 0; i < p_class->static_functions.size(); i++) {
-
_parser_show_function(p_class->static_functions[i], p_indent);
print_line("\n");
}
for (int i = 0; i < p_class->functions.size(); i++) {
-
if (String(p_class->functions[i]->name) == "_init") {
_parser_show_function(p_class->functions[i], p_indent, p_class->initializer);
} else
@@ -485,11 +447,9 @@ static void _parser_show_class(const GDScriptParser::ClassNode *p_class, int p_i
}
static String _disassemble_addr(const Ref<GDScript> &p_script, const GDScriptFunction &func, int p_addr) {
-
int addr = p_addr & GDScriptFunction::ADDR_MASK;
switch (p_addr >> GDScriptFunction::ADDR_BITS) {
-
case GDScriptFunction::ADDR_TYPE_SELF: {
return "self";
} break;
@@ -497,15 +457,12 @@ static String _disassemble_addr(const Ref<GDScript> &p_script, const GDScriptFun
return "class";
} break;
case GDScriptFunction::ADDR_TYPE_MEMBER: {
-
return "member(" + p_script->debug_get_member_by_index(addr) + ")";
} break;
case GDScriptFunction::ADDR_TYPE_CLASS_CONSTANT: {
-
return "class_const(" + func.get_global_name(addr) + ")";
} break;
case GDScriptFunction::ADDR_TYPE_LOCAL_CONSTANT: {
-
Variant v = func.get_constant(addr);
String txt;
if (v.get_type() == Variant::STRING || v.get_type() == Variant::NODE_PATH)
@@ -515,15 +472,12 @@ static String _disassemble_addr(const Ref<GDScript> &p_script, const GDScriptFun
return "const(" + txt + ")";
} break;
case GDScriptFunction::ADDR_TYPE_STACK: {
-
return "stack(" + itos(addr) + ")";
} break;
case GDScriptFunction::ADDR_TYPE_STACK_VARIABLE: {
-
return "var_stack(" + itos(addr) + ")";
} break;
case GDScriptFunction::ADDR_TYPE_GLOBAL: {
-
return "global(" + func.get_global_name(addr) + ")";
} break;
case GDScriptFunction::ADDR_TYPE_NIL: {
@@ -535,11 +489,9 @@ static String _disassemble_addr(const Ref<GDScript> &p_script, const GDScriptFun
}
static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String> &p_code) {
-
const Map<StringName, GDScriptFunction *> &mf = p_class->debug_get_member_functions();
for (const Map<StringName, GDScriptFunction *>::Element *E = mf.front(); E; E = E->next()) {
-
const GDScriptFunction &func = *E->get();
const int *code = func.get_code();
int codelen = func.get_code_size();
@@ -547,7 +499,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
if (func.get_default_argument_count()) {
defargs = "defarg at: ";
for (int i = 0; i < func.get_default_argument_count(); i++) {
-
if (i > 0)
defargs += ",";
defargs += itos(func.get_default_argument_addr(i));
@@ -559,14 +510,11 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
#define DADDR(m_ip) (_disassemble_addr(p_class, func, code[ip + m_ip]))
for (int ip = 0; ip < codelen;) {
-
int incr = 0;
String txt = itos(ip) + " ";
switch (code[ip]) {
-
case GDScriptFunction::OPCODE_OPERATOR: {
-
int op = code[ip + 1];
txt += " op ";
@@ -581,7 +529,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_SET: {
-
txt += "set ";
txt += DADDR(1);
txt += "[";
@@ -592,7 +539,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_GET: {
-
txt += " get ";
txt += DADDR(3);
txt += "=";
@@ -604,7 +550,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_SET_NAMED: {
-
txt += " set_named ";
txt += DADDR(1);
txt += "[\"";
@@ -615,7 +560,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_GET_NAMED: {
-
txt += " get_named ";
txt += DADDR(3);
txt += "=";
@@ -627,7 +571,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_SET_MEMBER: {
-
txt += " set_member ";
txt += "[\"";
txt += func.get_global_name(code[ip + 1]);
@@ -637,7 +580,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_GET_MEMBER: {
-
txt += " get_member ";
txt += DADDR(2);
txt += "=";
@@ -648,7 +590,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_ASSIGN: {
-
txt += " assign ";
txt += DADDR(1);
txt += "=";
@@ -657,7 +598,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_ASSIGN_TRUE: {
-
txt += " assign ";
txt += DADDR(1);
txt += "= true";
@@ -665,7 +605,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_ASSIGN_FALSE: {
-
txt += " assign ";
txt += DADDR(1);
txt += "= false";
@@ -673,7 +612,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_ASSIGN_TYPED_BUILTIN: {
-
txt += " assign typed builtin (";
txt += Variant::get_type_name((Variant::Type)code[ip + 1]);
txt += ") ";
@@ -697,7 +635,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_CAST_TO_SCRIPT: {
-
txt += " cast ";
txt += DADDR(3);
txt += "=";
@@ -708,7 +645,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_CONSTRUCT: {
-
Variant::Type t = Variant::Type(code[ip + 1]);
int argc = code[ip + 2];
@@ -718,7 +654,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
txt += Variant::get_type_name(t) + "(";
for (int i = 0; i < argc; i++) {
-
if (i > 0)
txt += ", ";
txt += DADDR(i + 3);
@@ -729,7 +664,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_CONSTRUCT_ARRAY: {
-
int argc = code[ip + 1];
txt += " make_array ";
txt += DADDR(2 + argc);
@@ -747,7 +681,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_CONSTRUCT_DICTIONARY: {
-
int argc = code[ip + 1];
txt += " make_dict ";
txt += DADDR(2 + argc * 2);
@@ -769,7 +702,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
case GDScriptFunction::OPCODE_CALL:
case GDScriptFunction::OPCODE_CALL_RETURN: {
-
bool ret = code[ip] == GDScriptFunction::OPCODE_CALL_RETURN;
if (ret)
@@ -797,7 +729,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_CALL_BUILT_IN: {
-
txt += " call-built-in ";
int argc = code[ip + 2];
@@ -817,7 +748,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_CALL_SELF_BASE: {
-
txt += " call-self-base ";
int argc = code[ip + 2];
@@ -837,13 +767,11 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_YIELD: {
-
txt += " yield ";
incr = 1;
} break;
case GDScriptFunction::OPCODE_YIELD_SIGNAL: {
-
txt += " yield_signal ";
txt += DADDR(1);
txt += ",";
@@ -851,13 +779,11 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
incr = 3;
} break;
case GDScriptFunction::OPCODE_YIELD_RESUME: {
-
txt += " yield resume: ";
txt += DADDR(1);
incr = 2;
} break;
case GDScriptFunction::OPCODE_JUMP: {
-
txt += " jump ";
txt += itos(code[ip + 1]);
@@ -865,7 +791,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_JUMP_IF: {
-
txt += " jump-if ";
txt += DADDR(1);
txt += " to ";
@@ -874,7 +799,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
incr = 3;
} break;
case GDScriptFunction::OPCODE_JUMP_IF_NOT: {
-
txt += " jump-if-not ";
txt += DADDR(1);
txt += " to ";
@@ -883,12 +807,10 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
incr = 3;
} break;
case GDScriptFunction::OPCODE_JUMP_TO_DEF_ARGUMENT: {
-
txt += " jump-to-default-argument ";
incr = 1;
} break;
case GDScriptFunction::OPCODE_RETURN: {
-
txt += " return ";
txt += DADDR(1);
@@ -896,19 +818,16 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
} break;
case GDScriptFunction::OPCODE_ITERATE_BEGIN: {
-
txt += " for-init " + DADDR(4) + " in " + DADDR(2) + " counter " + DADDR(1) + " end " + itos(code[ip + 3]);
incr += 5;
} break;
case GDScriptFunction::OPCODE_ITERATE: {
-
txt += " for-loop " + DADDR(4) + " in " + DADDR(2) + " counter " + DADDR(1) + " end " + itos(code[ip + 3]);
incr += 5;
} break;
case GDScriptFunction::OPCODE_LINE: {
-
int line = code[ip + 1] - 1;
if (line >= 0 && line < p_code.size())
txt = "\n" + itos(line + 1) + ": " + p_code[line] + "\n";
@@ -917,12 +836,10 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
incr += 2;
} break;
case GDScriptFunction::OPCODE_END: {
-
txt += " end";
incr += 1;
} break;
case GDScriptFunction::OPCODE_ASSERT: {
-
txt += " assert ";
txt += DADDR(1);
incr += 2;
@@ -931,7 +848,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
}
if (incr == 0) {
-
ERR_BREAK_MSG(true, "Unhandled opcode: " + itos(code[ip]));
}
@@ -943,7 +859,6 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
}
MainLoop *test(TestType p_type) {
-
List<String> cmdlargs = OS::get_singleton()->get_cmdline_args();
if (cmdlargs.empty()) {
@@ -972,21 +887,17 @@ MainLoop *test(TestType p_type) {
int last = 0;
for (int i = 0; i <= code.length(); i++) {
-
if (code[i] == '\n' || code[i] == 0) {
-
lines.push_back(code.substr(last, i - last));
last = i + 1;
}
}
if (p_type == TEST_TOKENIZER) {
-
GDScriptTokenizerText tk;
tk.set_code(code);
int line = -1;
while (tk.get_token() != GDScriptTokenizer::TK_EOF) {
-
String text;
if (tk.get_token() == GDScriptTokenizer::TK_IDENTIFIER)
text = "'" + tk.get_token_identifier() + "' (identifier)";
@@ -1024,7 +935,6 @@ MainLoop *test(TestType p_type) {
}
if (p_type == TEST_PARSER) {
-
GDScriptParser parser;
Error err = parser.parse(code);
if (err) {
@@ -1041,7 +951,6 @@ MainLoop *test(TestType p_type) {
}
if (p_type == TEST_COMPILER) {
-
GDScriptParser parser;
Error err = parser.parse(code);
@@ -1057,7 +966,6 @@ MainLoop *test(TestType p_type) {
GDScriptCompiler gdc;
err = gdc.compile(&parser, gds.ptr());
if (err) {
-
print_line("Compile Error:\n" + itos(gdc.get_error_line()) + ":" + itos(gdc.get_error_column()) + ":" + gdc.get_error());
return nullptr;
}
@@ -1065,7 +973,6 @@ MainLoop *test(TestType p_type) {
Ref<GDScript> current = gds;
while (current.is_valid()) {
-
print_line("** CLASS **");
_disassemble_class(current, lines);
@@ -1073,7 +980,6 @@ MainLoop *test(TestType p_type) {
}
} else if (p_type == TEST_BYTECODE) {
-
Vector<uint8_t> buf2 = GDScriptTokenizerBuffer::parse_code_string(code);
String dst = test.get_basename() + ".gdc";
FileAccess *fw = FileAccess::open(dst, FileAccess::WRITE);
diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp
index c5c8917a51..14bc13ff61 100644
--- a/main/tests/test_gui.cpp
+++ b/main/tests/test_gui.cpp
@@ -59,14 +59,11 @@
namespace TestGUI {
class TestMainLoop : public SceneTree {
-
public:
virtual void request_quit() {
-
quit();
}
virtual void init() {
-
SceneTree::init();
Panel *frame = memnew(Panel);
@@ -266,7 +263,6 @@ public:
};
MainLoop *test() {
-
return memnew(TestMainLoop);
}
} // namespace TestGUI
diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp
index 922a55b88e..eb60372e6c 100644
--- a/main/tests/test_main.cpp
+++ b/main/tests/test_main.cpp
@@ -47,7 +47,6 @@
#include "test_string.h"
const char **tests_get_names() {
-
static const char *test_names[] = {
"string",
"math",
@@ -70,76 +69,61 @@ const char **tests_get_names() {
}
MainLoop *test_main(String p_test, const List<String> &p_args) {
-
if (p_test == "string") {
-
return TestString::test();
}
if (p_test == "math") {
-
return TestMath::test();
}
if (p_test == "physics_2d") {
-
return TestPhysics2D::test();
}
if (p_test == "physics_3d") {
-
return TestPhysics3D::test();
}
if (p_test == "render") {
-
return TestRender::test();
}
if (p_test == "oa_hash_map") {
-
return TestOAHashMap::test();
}
#ifndef _3D_DISABLED
if (p_test == "gui") {
-
return TestGUI::test();
}
#endif
if (p_test == "shaderlang") {
-
return TestShaderLang::test();
}
if (p_test == "gd_tokenizer") {
-
return TestGDScript::test(TestGDScript::TEST_TOKENIZER);
}
if (p_test == "gd_parser") {
-
return TestGDScript::test(TestGDScript::TEST_PARSER);
}
if (p_test == "gd_compiler") {
-
return TestGDScript::test(TestGDScript::TEST_COMPILER);
}
if (p_test == "gd_bytecode") {
-
return TestGDScript::test(TestGDScript::TEST_BYTECODE);
}
if (p_test == "ordered_hash_map") {
-
return TestOrderedHashMap::test();
}
if (p_test == "astar") {
-
return TestAStar::test();
}
@@ -150,7 +134,6 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
#else
const char **tests_get_names() {
-
static const char *test_names[] = {
nullptr
};
@@ -159,7 +142,6 @@ const char **tests_get_names() {
}
MainLoop *test_main(String p_test, const List<String> &p_args) {
-
return nullptr;
}
diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp
index fbd1aa275a..33589e37af 100644
--- a/main/tests/test_math.cpp
+++ b/main/tests/test_math.cpp
@@ -50,7 +50,6 @@
namespace TestMath {
class GetClassAndNamespace {
-
String code;
int idx;
int line;
@@ -77,12 +76,9 @@ class GetClassAndNamespace {
};
Token get_token() {
-
while (true) {
switch (code[idx]) {
-
case '\n': {
-
line++;
idx++;
break;
@@ -92,37 +88,30 @@ class GetClassAndNamespace {
} break;
case '{': {
-
idx++;
return TK_CURLY_BRACKET_OPEN;
};
case '}': {
-
idx++;
return TK_CURLY_BRACKET_CLOSE;
};
case '[': {
-
idx++;
return TK_BRACKET_OPEN;
};
case ']': {
-
idx++;
return TK_BRACKET_CLOSE;
};
case ':': {
-
idx++;
return TK_COLON;
};
case ',': {
-
idx++;
return TK_COMMA;
};
case '.': {
-
idx++;
return TK_PERIOD;
};
@@ -134,7 +123,6 @@ class GetClassAndNamespace {
continue;
} break;
case '/': {
-
switch (code[idx + 1]) {
case '*': { // block comment
@@ -145,7 +133,6 @@ class GetClassAndNamespace {
error = true;
return TK_ERROR;
} else if (code[idx] == '*' && code[idx + 1] == '/') {
-
idx += 2;
break;
} else if (code[idx] == '\n') {
@@ -174,7 +161,6 @@ class GetClassAndNamespace {
} break;
case '\'':
case '"': {
-
CharType begin_str = code[idx];
idx++;
String tk_string = String();
@@ -198,7 +184,6 @@ class GetClassAndNamespace {
CharType res = 0;
switch (next) {
-
case 'b':
res = 8;
break;
@@ -241,7 +226,6 @@ class GetClassAndNamespace {
} break;
default: {
-
if (code[idx] <= 32) {
idx++;
break;
@@ -262,11 +246,9 @@ class GetClassAndNamespace {
return TK_NUMBER;
} else if ((code[idx] >= 'A' && code[idx] <= 'Z') || (code[idx] >= 'a' && code[idx] <= 'z') || code[idx] > 127) {
-
String id;
while ((code[idx] >= 'A' && code[idx] <= 'Z') || (code[idx] >= 'a' && code[idx] <= 'z') || code[idx] > 127) {
-
id += code[idx];
idx++;
}
@@ -285,7 +267,6 @@ class GetClassAndNamespace {
public:
Error parse(const String &p_code, const String &p_known_class_name = String()) {
-
code = p_code;
idx = 0;
line = 0;
@@ -301,7 +282,6 @@ public:
int curly_stack = 0;
while (!error || tk != TK_EOF) {
-
if (tk == TK_BRACKET_OPEN) {
tk = get_token();
if (tk == TK_IDENTIFIER && String(value) == "ScriptClass") {
@@ -374,7 +354,6 @@ public:
};
void test_vec(Plane p_vec) {
-
CameraMatrix cm;
cm.set_perspective(45, 1, 0, 100);
Plane v0 = cm.xform4(p_vec);
@@ -413,7 +392,6 @@ uint32_t ihash3(uint32_t a) {
}
MainLoop *test() {
-
{
Vector<Vector3> points;
points.push_back(Vector3(0, 0, 0));
@@ -564,26 +542,22 @@ MainLoop *test() {
}
{
-
Vector<int> hashes;
List<StringName> tl;
ClassDB::get_class_list(&tl);
for (List<StringName>::Element *E = tl.front(); E; E = E->next()) {
-
Vector<uint8_t> m5b = E->get().operator String().md5_buffer();
hashes.push_back(hashes.size());
}
for (int i = nearest_shift(hashes.size()); i < 20; i++) {
-
bool success = true;
for (int s = 0; s < 10000; s++) {
Set<uint32_t> existing;
success = true;
for (int j = 0; j < hashes.size(); j++) {
-
uint32_t eh = ihash2(ihash3(hashes[j] + ihash(s) + s)) & ((1 << i) - 1);
if (existing.has(eh)) {
success = false;
diff --git a/main/tests/test_oa_hash_map.cpp b/main/tests/test_oa_hash_map.cpp
index cffec7fa77..b14fda15c4 100644
--- a/main/tests/test_oa_hash_map.cpp
+++ b/main/tests/test_oa_hash_map.cpp
@@ -36,7 +36,6 @@
namespace TestOAHashMap {
MainLoop *test() {
-
OS::get_singleton()->print("\n\n\nHello from test\n");
// test element tracking.
@@ -122,7 +121,6 @@ MainLoop *test() {
// regression test / test for issue related to #31402
{
-
OS::get_singleton()->print("test for issue #31402 started...\n");
const int num_test_values = 12;
diff --git a/main/tests/test_ordered_hash_map.cpp b/main/tests/test_ordered_hash_map.cpp
index e909626243..12d9e7906c 100644
--- a/main/tests/test_ordered_hash_map.cpp
+++ b/main/tests/test_ordered_hash_map.cpp
@@ -146,7 +146,6 @@ TestFunc test_funcs[] = {
};
MainLoop *test() {
-
int count = 0;
int passed = 0;
diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp
index 6feff3b0a9..7bb6dfedc9 100644
--- a/main/tests/test_physics_2d.cpp
+++ b/main/tests/test_physics_2d.cpp
@@ -44,7 +44,6 @@ static const unsigned char convex_png[] = {
};
class TestPhysics2DMainLoop : public MainLoop {
-
GDCLASS(TestPhysics2DMainLoop, MainLoop);
RID circle_img;
@@ -58,7 +57,6 @@ class TestPhysics2DMainLoop : public MainLoop {
Vector2 ray_from, ray_to;
struct BodyShapeData {
-
RID image;
RID shape;
};
@@ -72,13 +70,10 @@ class TestPhysics2DMainLoop : public MainLoop {
// SEGMENT
{
-
Vector<uint8_t> pixels;
pixels.resize(32 * 2 * 2);
for (int i = 0; i < 2; i++) {
-
for (int j = 0; j < 32; j++) {
-
pixels.set(i * 32 * 2 + j * 2 + 0, (j == 0) ? 255 : 0);
pixels.set(i * 32 * 2 + j * 2 + 1, 255);
}
@@ -97,13 +92,10 @@ class TestPhysics2DMainLoop : public MainLoop {
// CIRCLE
{
-
Vector<uint8_t> pixels;
pixels.resize(32 * 32 * 2);
for (int i = 0; i < 32; i++) {
-
for (int j = 0; j < 32; j++) {
-
bool black = Vector2(i - 16, j - 16).length_squared() < 16 * 16;
pixels.set(i * 32 * 2 + j * 2 + 0, (i == 16 || j == 16) ? 255 : 0);
@@ -124,13 +116,10 @@ class TestPhysics2DMainLoop : public MainLoop {
// BOX
{
-
Vector<uint8_t> pixels;
pixels.resize(32 * 32 * 2);
for (int i = 0; i < 32; i++) {
-
for (int j = 0; j < 32; j++) {
-
bool black = i > 0 && i < 31 && j > 0 && j < 31;
pixels.set(i * 32 * 2 + j * 2 + 0, black ? 0 : 255);
@@ -151,13 +140,10 @@ class TestPhysics2DMainLoop : public MainLoop {
// CAPSULE
{
-
Vector<uint8_t> pixels;
pixels.resize(32 * 64 * 2);
for (int i = 0; i < 64; i++) {
-
for (int j = 0; j < 32; j++) {
-
int si = i > 48 ? i - 32 : (i < 16 ? i : 16);
bool black = Vector2(si - 16, j - 16).length_squared() < 16 * 16;
@@ -179,7 +165,6 @@ class TestPhysics2DMainLoop : public MainLoop {
// CONVEX
{
-
Ref<Image> image = memnew(Image(convex_png));
body_shape_data[PhysicsServer2D::SHAPE_CONVEX_POLYGON].image = vs->texture_2d_create(image);
@@ -202,7 +187,6 @@ class TestPhysics2DMainLoop : public MainLoop {
}
void _do_ray_query() {
-
/*
PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
ps->query_intersection_segment(ray_query,ray_from,ray_to);
@@ -211,13 +195,10 @@ class TestPhysics2DMainLoop : public MainLoop {
protected:
void input_event(const Ref<InputEvent> &p_event) {
-
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) {
-
if (mb->is_pressed()) {
-
Point2 p(mb->get_position().x, mb->get_position().y);
if (mb->get_button_index() == 1) {
@@ -233,7 +214,6 @@ protected:
Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid()) {
-
Point2 p = mm->get_position();
if (mm->get_button_mask() & BUTTON_MASK_LEFT) {
@@ -247,7 +227,6 @@ protected:
}
RID _add_body(PhysicsServer2D::ShapeType p_shape, const Transform2D &p_xform) {
-
RenderingServer *vs = RenderingServer::get_singleton();
PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
@@ -272,7 +251,6 @@ protected:
}
void _add_plane(const Vector2 &p_normal, real_t p_d) {
-
PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
Array arr;
@@ -289,7 +267,6 @@ protected:
}
void _add_concave(const Vector<Vector2> &p_points, const Transform2D &p_xform = Transform2D()) {
-
PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
RenderingServer *vs = RenderingServer::get_singleton();
@@ -315,7 +292,6 @@ protected:
}
void _ray_query_callback(const RID &p_rid, ObjectID p_id, int p_shape, const Vector2 &p_point, const Vector2 &p_normal) {
-
Vector2 ray_end;
if (p_rid.is_valid()) {
@@ -333,14 +309,12 @@ protected:
}
static void _bind_methods() {
-
ClassDB::bind_method(D_METHOD("_body_moved"), &TestPhysics2DMainLoop::_body_moved);
ClassDB::bind_method(D_METHOD("_ray_query_callback"), &TestPhysics2DMainLoop::_ray_query_callback);
}
public:
virtual void init() {
-
RenderingServer *vs = RenderingServer::get_singleton();
PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
@@ -351,7 +325,6 @@ public:
ps->area_set_param(space, PhysicsServer2D::AREA_PARAM_GRAVITY, 98);
{
-
RID vp = vs->viewport_create();
canvas = vs->canvas_create();
@@ -377,7 +350,6 @@ public:
_create_body_shape_data();
for (int i = 0; i < 32; i++) {
-
PhysicsServer2D::ShapeType types[4] = {
PhysicsServer2D::SHAPE_CIRCLE,
PhysicsServer2D::SHAPE_CAPSULE,
@@ -402,7 +374,6 @@ public:
Vector<Point2> parr;
for (int i = 0; i < 30; i++) {
-
Point2 p(i * 60, Math::randf() * 70 + 340);
if (i > 0) {
parr.push_back(prev);
@@ -418,7 +389,6 @@ public:
}
virtual bool idle(float p_time) {
-
return false;
}
virtual void finish() {
@@ -430,7 +400,6 @@ public:
namespace TestPhysics2D {
MainLoop *test() {
-
return memnew(TestPhysics2DMainLoop);
}
} // namespace TestPhysics2D
diff --git a/main/tests/test_physics_3d.cpp b/main/tests/test_physics_3d.cpp
index 2d208ee317..0552db86a2 100644
--- a/main/tests/test_physics_3d.cpp
+++ b/main/tests/test_physics_3d.cpp
@@ -41,7 +41,6 @@
#include "servers/rendering_server.h"
class TestPhysics3DMainLoop : public MainLoop {
-
GDCLASS(TestPhysics3DMainLoop, MainLoop);
enum {
@@ -69,7 +68,6 @@ class TestPhysics3DMainLoop : public MainLoop {
Map<PhysicsServer3D::ShapeType, RID> type_mesh_map;
void body_changed_transform(Object *p_state, RID p_visual_instance) {
-
PhysicsDirectBodyState3D *state = (PhysicsDirectBodyState3D *)p_state;
RenderingServer *vs = RenderingServer::get_singleton();
Transform t = state->get_transform();
@@ -80,12 +78,10 @@ class TestPhysics3DMainLoop : public MainLoop {
protected:
static void _bind_methods() {
-
ClassDB::bind_method("body_changed_transform", &TestPhysics3DMainLoop::body_changed_transform);
}
RID create_body(PhysicsServer3D::ShapeType p_shape, PhysicsServer3D::BodyMode p_body, const Transform p_location, bool p_active_default = true, const Transform &p_shape_xform = Transform()) {
-
RenderingServer *vs = RenderingServer::get_singleton();
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
@@ -101,14 +97,12 @@ protected:
bodies.push_back(body);
if (p_body == PhysicsServer3D::BODY_MODE_STATIC) {
-
vs->instance_set_transform(mesh_instance, p_location);
}
return body;
}
RID create_static_plane(const Plane &p_plane) {
-
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
RID world_margin_shape = ps->shape_create(PhysicsServer3D::SHAPE_PLANE);
@@ -122,7 +116,6 @@ protected:
}
void configure_body(RID p_body, float p_mass, float p_friction, float p_bounce) {
-
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
ps->body_set_param(p_body, PhysicsServer3D::BODY_PARAM_MASS, p_mass);
ps->body_set_param(p_body, PhysicsServer3D::BODY_PARAM_FRICTION, p_friction);
@@ -130,7 +123,6 @@ protected:
}
void init_shapes() {
-
RenderingServer *vs = RenderingServer::get_singleton();
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
@@ -188,7 +180,6 @@ protected:
}
void make_trimesh(Vector<Vector3> p_faces, const Transform &p_xform = Transform()) {
-
RenderingServer *vs = RenderingServer::get_singleton();
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
RID trimesh_shape = ps->shape_create(PhysicsServer3D::SHAPE_CONCAVE_POLYGON);
@@ -196,7 +187,6 @@ protected:
p_faces = ps->shape_get_data(trimesh_shape); // optimized one
Vector<Vector3> normals; // for drawing
for (int i = 0; i < p_faces.size() / 3; i++) {
-
Plane p(p_faces[i * 3 + 0], p_faces[i * 3 + 1], p_faces[i * 3 + 2]);
normals.push_back(p.normal);
normals.push_back(p.normal);
@@ -222,17 +212,14 @@ protected:
}
void make_grid(int p_width, int p_height, float p_cellsize, float p_cellheight, const Transform &p_xform = Transform()) {
-
Vector<Vector<float>> grid;
grid.resize(p_width);
for (int i = 0; i < p_width; i++) {
-
grid.write[i].resize(p_height);
for (int j = 0; j < p_height; j++) {
-
grid.write[i].write[j] = 1.0 + Math::random(-p_cellheight, p_cellheight);
}
}
@@ -240,9 +227,7 @@ protected:
Vector<Vector3> faces;
for (int i = 1; i < p_width; i++) {
-
for (int j = 1; j < p_height; j++) {
-
#define MAKE_VERTEX(m_x, m_z) \
faces.push_back(Vector3((m_x - p_width / 2) * p_cellsize, grid[m_x][m_z], (m_z - p_height / 2) * p_cellsize))
@@ -261,21 +246,17 @@ protected:
public:
virtual void input_event(const Ref<InputEvent> &p_event) {
-
Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid() && mm->get_button_mask() & 4) {
-
ofs_y -= mm->get_relative().y / 200.0;
ofs_x += mm->get_relative().x / 200.0;
}
if (mm.is_valid() && mm->get_button_mask() & 1) {
-
float y = -mm->get_relative().y / 20.0;
float x = mm->get_relative().x / 20.0;
if (mover.is_valid()) {
-
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
Transform t = ps->body_get_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM);
t.origin += Vector3(x, y, 0);
@@ -286,11 +267,9 @@ public:
}
virtual void request_quit() {
-
quit = true;
}
virtual void init() {
-
ofs_x = ofs_y = 0;
init_shapes();
@@ -332,7 +311,6 @@ public:
quit = false;
}
virtual bool iteration(float p_time) {
-
if (mover.is_valid()) {
static float joy_speed = 10;
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
@@ -360,7 +338,6 @@ public:
}
void test_character() {
-
RenderingServer *vs = RenderingServer::get_singleton();
PhysicsServer3D *ps = PhysicsServer3D::get_singleton();
@@ -393,9 +370,7 @@ public:
}
void test_fall() {
-
for (int i = 0; i < 35; i++) {
-
static const PhysicsServer3D::ShapeType shape_idx[] = {
PhysicsServer3D::SHAPE_CAPSULE,
PhysicsServer3D::SHAPE_BOX,
@@ -417,7 +392,6 @@ public:
}
void test_activate() {
-
create_body(PhysicsServer3D::SHAPE_BOX, PhysicsServer3D::BODY_MODE_RIGID, Transform(Basis(), Vector3(0, 2, 0)), true);
create_static_plane(Plane(Vector3(0, 1, 0), -1));
}
@@ -433,7 +407,6 @@ public:
namespace TestPhysics3D {
MainLoop *test() {
-
return memnew(TestPhysics3DMainLoop);
}
} // namespace TestPhysics3D
diff --git a/main/tests/test_render.cpp b/main/tests/test_render.cpp
index bcfcf61e25..b512a17e55 100644
--- a/main/tests/test_render.cpp
+++ b/main/tests/test_render.cpp
@@ -44,7 +44,6 @@
namespace TestRender {
class TestMainLoop : public MainLoop {
-
RID test_cube;
RID instance;
RID camera;
@@ -53,7 +52,6 @@ class TestMainLoop : public MainLoop {
RID scenario;
struct InstanceInfo {
-
RID instance;
Transform base;
Vector3 rot_axis;
@@ -67,13 +65,11 @@ class TestMainLoop : public MainLoop {
protected:
public:
virtual void input_event(const Ref<InputEvent> &p_event) {
-
if (p_event->is_pressed())
quit = true;
}
virtual void init() {
-
print_line("INITIALIZING TEST RENDER");
RenderingServer *vs = RenderingServer::get_singleton();
test_cube = vs->get_test_cube();
@@ -144,7 +140,6 @@ public:
};
for (int i = 0; i < object_count; i++) {
-
InstanceInfo ii;
ii.instance = vs->instance_create2(test_cube, scenario);
@@ -205,7 +200,6 @@ public:
quit = false;
}
virtual bool iteration(float p_time) {
-
RenderingServer *vs = RenderingServer::get_singleton();
//Transform t;
//t.rotate(Vector3(0, 1, 0), ofs);
@@ -217,7 +211,6 @@ public:
//return quit;
for (List<InstanceInfo>::Element *E = instances.front(); E; E = E->next()) {
-
Transform pre(Basis(E->get().rot_axis, ofs), Vector3());
vs->instance_set_transform(E->get().instance, pre * E->get().base);
/*
@@ -240,7 +233,6 @@ public:
};
MainLoop *test() {
-
return memnew(TestMainLoop);
}
} // namespace TestRender
diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp
index abcf30c97f..42d4841ecf 100644
--- a/main/tests/test_shader_lang.cpp
+++ b/main/tests/test_shader_lang.cpp
@@ -44,7 +44,6 @@ typedef ShaderLanguage SL;
namespace TestShaderLang {
static String _mktab(int p_level) {
-
String tb;
for (int i = 0; i < p_level; i++) {
tb += "\t";
@@ -54,12 +53,10 @@ static String _mktab(int p_level) {
}
static String _typestr(SL::DataType p_type) {
-
return ShaderLanguage::get_datatype_name(p_type);
}
static String _prestr(SL::DataPrecision p_pres) {
-
switch (p_pres) {
case SL::PRECISION_LOWP:
return "lowp ";
@@ -74,12 +71,10 @@ static String _prestr(SL::DataPrecision p_pres) {
}
static String _opstr(SL::Operator p_op) {
-
return ShaderLanguage::get_operator_text(p_op);
}
static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNode::Value> &p_values) {
-
switch (p_type) {
case SL::TYPE_BOOL:
return p_values[0].boolean ? "true" : "false";
@@ -119,17 +114,13 @@ static String get_constant_text(SL::DataType p_type, const Vector<SL::ConstantNo
}
static String dump_node_code(SL::Node *p_node, int p_level) {
-
String code;
switch (p_node->type) {
-
case SL::Node::TYPE_SHADER: {
-
SL::ShaderNode *pnode = (SL::ShaderNode *)p_node;
for (Map<StringName, SL::ShaderNode::Uniform>::Element *E = pnode->uniforms.front(); E; E = E->next()) {
-
String ucode = "uniform ";
ucode += _prestr(E->get().precision);
ucode += _typestr(E->get().type);
@@ -156,7 +147,6 @@ static String dump_node_code(SL::Node *p_node, int p_level) {
}
for (Map<StringName, SL::ShaderNode::Varying>::Element *E = pnode->varyings.front(); E; E = E->next()) {
-
String vcode = "varying ";
vcode += _prestr(E->get().precision);
vcode += _typestr(E->get().type);
@@ -165,13 +155,11 @@ static String dump_node_code(SL::Node *p_node, int p_level) {
code += vcode + "\n";
}
for (int i = 0; i < pnode->functions.size(); i++) {
-
SL::FunctionNode *fnode = pnode->functions[i].function;
String header;
header = _typestr(fnode->return_type) + " " + fnode->name + "(";
for (int j = 0; j < fnode->arguments.size(); j++) {
-
if (j > 0)
header += ", ";
header += _prestr(fnode->arguments[j].precision) + _typestr(fnode->arguments[j].type) + " " + fnode->arguments[j].name;
@@ -185,10 +173,8 @@ static String dump_node_code(SL::Node *p_node, int p_level) {
//code+=dump_node_code(pnode->body,p_level);
} break;
case SL::Node::TYPE_STRUCT: {
-
} break;
case SL::Node::TYPE_FUNCTION: {
-
} break;
case SL::Node::TYPE_BLOCK: {
SL::BlockNode *bnode = (SL::BlockNode *)p_node;
@@ -196,12 +182,10 @@ static String dump_node_code(SL::Node *p_node, int p_level) {
//variables
code += _mktab(p_level - 1) + "{\n";
for (Map<StringName, SL::BlockNode::Variable>::Element *E = bnode->variables.front(); E; E = E->next()) {
-
code += _mktab(p_level) + _prestr(E->get().precision) + _typestr(E->get().type) + " " + E->key() + ";\n";
}
for (int i = 0; i < bnode->statements.size(); i++) {
-
String scode = dump_node_code(bnode->statements[i], p_level);
if (bnode->statements[i]->type == SL::Node::TYPE_CONTROL_FLOW) {
@@ -240,7 +224,6 @@ static String dump_node_code(SL::Node *p_node, int p_level) {
SL::OperatorNode *onode = (SL::OperatorNode *)p_node;
switch (onode->op) {
-
case SL::OP_ASSIGN:
case SL::OP_ASSIGN_ADD:
case SL::OP_ASSIGN_SUB:
@@ -276,7 +259,6 @@ static String dump_node_code(SL::Node *p_node, int p_level) {
code += ")";
break;
default: {
-
code = "(" + dump_node_code(onode->arguments[0], p_level) + _opstr(onode->op) + dump_node_code(onode->arguments[1], p_level) + ")";
break;
}
@@ -286,17 +268,14 @@ static String dump_node_code(SL::Node *p_node, int p_level) {
case SL::Node::TYPE_CONTROL_FLOW: {
SL::ControlFlowNode *cfnode = (SL::ControlFlowNode *)p_node;
if (cfnode->flow_op == SL::FLOW_OP_IF) {
-
code += _mktab(p_level) + "if (" + dump_node_code(cfnode->expressions[0], p_level) + ")\n";
code += dump_node_code(cfnode->blocks[0], p_level + 1);
if (cfnode->blocks.size() == 2) {
-
code += _mktab(p_level) + "else\n";
code += dump_node_code(cfnode->blocks[1], p_level + 1);
}
} else if (cfnode->flow_op == SL::FLOW_OP_RETURN) {
-
if (cfnode->blocks.size()) {
code = "return " + dump_node_code(cfnode->blocks[0], p_level);
} else {
@@ -316,7 +295,6 @@ static String dump_node_code(SL::Node *p_node, int p_level) {
}
static Error recreate_code(void *p_str, SL::ShaderNode *p_program) {
-
String *str = (String *)p_str;
*str = dump_node_code(p_program, 0);
@@ -325,7 +303,6 @@ static Error recreate_code(void *p_str, SL::ShaderNode *p_program) {
}
MainLoop *test() {
-
List<String> cmdlargs = OS::get_singleton()->get_cmdline_args();
if (cmdlargs.empty()) {
@@ -366,7 +343,6 @@ MainLoop *test() {
Error err = sl.compile(code, dt, rm, types, nullptr);
if (err) {
-
print_line("Error at line: " + rtos(sl.get_error_line()) + ": " + sl.get_error_text());
return nullptr;
} else {
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index 76631f9eae..aa59b74371 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -45,7 +45,6 @@
namespace TestString {
bool test_1() {
-
OS::get_singleton()->print("\n\nTest 1: Assign from cstr\n");
String s = "Hello";
@@ -57,7 +56,6 @@ bool test_1() {
}
bool test_2() {
-
OS::get_singleton()->print("\n\nTest 2: Assign from string (operator=)\n");
String s = "Dolly";
@@ -70,7 +68,6 @@ bool test_2() {
}
bool test_3() {
-
OS::get_singleton()->print("\n\nTest 3: Assign from c-string (copycon)\n");
String s("Sheep");
@@ -83,7 +80,6 @@ bool test_3() {
}
bool test_4() {
-
OS::get_singleton()->print("\n\nTest 4: Assign from c-widechar (operator=)\n");
String s(L"Give me");
@@ -95,7 +91,6 @@ bool test_4() {
}
bool test_5() {
-
OS::get_singleton()->print("\n\nTest 5: Assign from c-widechar (copycon)\n");
String s(L"Wool");
@@ -107,7 +102,6 @@ bool test_5() {
}
bool test_6() {
-
OS::get_singleton()->print("\n\nTest 6: comparisons (equal)\n");
String s = "Test Compare";
@@ -127,7 +121,6 @@ bool test_6() {
}
bool test_7() {
-
OS::get_singleton()->print("\n\nTest 7: comparisons (unequal)\n");
String s = "Test Compare";
@@ -147,7 +140,6 @@ bool test_7() {
}
bool test_8() {
-
OS::get_singleton()->print("\n\nTest 8: comparisons (operator<)\n");
String s = "Bees";
@@ -167,7 +159,6 @@ bool test_8() {
}
bool test_9() {
-
OS::get_singleton()->print("\n\nTest 9: Concatenation\n");
String s;
@@ -186,7 +177,6 @@ bool test_9() {
}
bool test_10() {
-
OS::get_singleton()->print("\n\nTest 10: Misc funcs (size/length/empty/etc)\n");
if (!String("").empty())
@@ -202,7 +192,6 @@ bool test_10() {
}
bool test_11() {
-
OS::get_singleton()->print("\n\nTest 11: Operator[]\n");
String a = "Kugar Sane";
@@ -220,7 +209,6 @@ bool test_11() {
}
bool test_12() {
-
OS::get_singleton()->print("\n\nTest 12: case functions\n");
String a = "MoMoNgA";
@@ -235,7 +223,6 @@ bool test_12() {
}
bool test_13() {
-
OS::get_singleton()->print("\n\nTest 13: UTF8\n");
/* how can i embed UTF in here? */
@@ -252,7 +239,6 @@ bool test_13() {
}
bool test_14() {
-
OS::get_singleton()->print("\n\nTest 14: ASCII\n");
String s = L"Primero Leche";
@@ -263,7 +249,6 @@ bool test_14() {
}
bool test_15() {
-
OS::get_singleton()->print("\n\nTest 15: substr\n");
String s = "Killer Baby";
@@ -273,7 +258,6 @@ bool test_15() {
}
bool test_16() {
-
OS::get_singleton()->print("\n\nTest 16: find\n");
String s = "Pretty Woman";
@@ -291,7 +275,6 @@ bool test_16() {
}
bool test_17() {
-
OS::get_singleton()->print("\n\nTest 17: find no case\n");
String s = "Pretty Whale";
@@ -309,7 +292,6 @@ bool test_17() {
}
bool test_18() {
-
OS::get_singleton()->print("\n\nTest 18: find no case\n");
String s = "Pretty Whale";
@@ -327,7 +309,6 @@ bool test_18() {
}
bool test_19() {
-
OS::get_singleton()->print("\n\nTest 19: Search & replace\n");
String s = "Happy Birthday, Anna!";
@@ -340,7 +321,6 @@ bool test_19() {
}
bool test_20() {
-
OS::get_singleton()->print("\n\nTest 20: Insertion\n");
String s = "Who is Frederic?";
@@ -353,7 +333,6 @@ bool test_20() {
}
bool test_21() {
-
OS::get_singleton()->print("\n\nTest 21: Number -> String\n");
OS::get_singleton()->print("\tPi is %f\n", 33.141593);
@@ -363,7 +342,6 @@ bool test_21() {
}
bool test_22() {
-
OS::get_singleton()->print("\n\nTest 22: String -> Int\n");
static const char *nums[4] = { "1237461283", "- 22", "0", " - 1123412" };
@@ -380,7 +358,6 @@ bool test_22() {
}
bool test_23() {
-
OS::get_singleton()->print("\n\nTest 23: String -> Float\n");
static const char *nums[4] = { "-12348298412.2", "0.05", "2.0002", " -0.0001" };
@@ -397,7 +374,6 @@ bool test_23() {
}
bool test_24() {
-
OS::get_singleton()->print("\n\nTest 24: Slicing\n");
String s = "Mars,Jupiter,Saturn,Uranus";
@@ -407,7 +383,6 @@ bool test_24() {
OS::get_singleton()->print("\tSlicing \"%ls\" by \"%s\"..\n", s.c_str(), ",");
for (int i = 0; i < s.get_slice_count(","); i++) {
-
OS::get_singleton()->print("\t\t%i- %ls\n", i + 1, s.get_slice(",", i).c_str());
if (s.get_slice(",", i) != slices[i])
@@ -418,7 +393,6 @@ bool test_24() {
}
bool test_25() {
-
OS::get_singleton()->print("\n\nTest 25: Erasing\n");
String s = "Josephine is such a cute girl!";
@@ -433,7 +407,6 @@ bool test_25() {
}
bool test_26() {
-
OS::get_singleton()->print("\n\nTest 26: RegEx substitution\n");
#ifndef MODULE_REGEX_ENABLED
@@ -461,7 +434,6 @@ struct test_27_data {
};
bool test_27() {
-
OS::get_singleton()->print("\n\nTest 27: begins_with\n");
test_27_data tc[] = {
{ "res://foobar", "res://", true },
@@ -486,7 +458,6 @@ bool test_27() {
};
bool test_28() {
-
OS::get_singleton()->print("\n\nTest 28: sprintf\n");
bool success, state = true;
@@ -822,7 +793,6 @@ bool test_28() {
}
bool test_29() {
-
bool state = true;
IP_Address ip0("2001:0db8:85a3:0000:0000:8a2e:0370:7334");
@@ -997,7 +967,6 @@ bool test_31() {
};
bool test_32() {
-
#define STRIP_TEST(x) \
{ \
bool success = x; \
@@ -1173,7 +1142,6 @@ TestFunc test_funcs[] = {
};
MainLoop *test() {
-
/** A character length != wchar_t may be forced, so the tests won't work */
static_assert(sizeof(CharType) == sizeof(wchar_t));