You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
This commit is contained in:
@@ -104,14 +104,17 @@ bool test_6() {
|
||||
|
||||
OS::get_singleton()->print("\tComparing to \"Test Compare\"\n");
|
||||
|
||||
if (!(s == "Test Compare"))
|
||||
if (!(s == "Test Compare")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(s == L"Test Compare"))
|
||||
if (!(s == L"Test Compare")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(s == String("Test Compare")))
|
||||
if (!(s == String("Test Compare"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -123,14 +126,17 @@ bool test_7() {
|
||||
|
||||
OS::get_singleton()->print("\tComparing to \"Test Compare\"\n");
|
||||
|
||||
if (!(s != "Peanut"))
|
||||
if (!(s != "Peanut")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(s != L"Coconut"))
|
||||
if (!(s != L"Coconut")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(s != String("Butter")))
|
||||
if (!(s != String("Butter"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -142,14 +148,17 @@ bool test_8() {
|
||||
|
||||
OS::get_singleton()->print("\tComparing to \"Bees\"\n");
|
||||
|
||||
if (!(s < "Elephant"))
|
||||
if (!(s < "Elephant")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s < L"Amber")
|
||||
if (s < L"Amber") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s < String("Beatrix"))
|
||||
if (s < String("Beatrix")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -175,14 +184,17 @@ bool test_9() {
|
||||
bool test_10() {
|
||||
OS::get_singleton()->print("\n\nTest 10: Misc funcs (size/length/empty/etc)\n");
|
||||
|
||||
if (!String("").empty())
|
||||
if (!String("").empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (String("Mellon").size() != 7)
|
||||
if (String("Mellon").size() != 7) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (String("Oranges").length() != 7)
|
||||
if (String("Oranges").length() != 7) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -195,11 +207,13 @@ bool test_11() {
|
||||
a[0] = 'S';
|
||||
a[6] = 'C';
|
||||
|
||||
if (a != "Sugar Cane")
|
||||
if (a != "Sugar Cane") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a[1] != 'u')
|
||||
if (a[1] != 'u') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -209,11 +223,13 @@ bool test_12() {
|
||||
|
||||
String a = "MoMoNgA";
|
||||
|
||||
if (a.to_upper() != "MOMONGA")
|
||||
if (a.to_upper() != "MOMONGA") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a.nocasecmp_to("momonga") != 0)
|
||||
if (a.nocasecmp_to("momonga") != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -261,11 +277,13 @@ bool test_16() {
|
||||
OS::get_singleton()->print("\t\"tty\" is at %i pos.\n", s.find("tty"));
|
||||
OS::get_singleton()->print("\t\"Revenge of the Monster Truck\" is at %i pos.\n", s.find("Revenge of the Monster Truck"));
|
||||
|
||||
if (s.find("tty") != 3)
|
||||
if (s.find("tty") != 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s.find("Revenge of the Monster Truck") != -1)
|
||||
if (s.find("Revenge of the Monster Truck") != -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -278,11 +296,13 @@ bool test_17() {
|
||||
OS::get_singleton()->print("\t\"WHA\" is at %i pos.\n", s.findn("WHA"));
|
||||
OS::get_singleton()->print("\t\"Revenge of the Monster SawFish\" is at %i pos.\n", s.findn("Revenge of the Monster Truck"));
|
||||
|
||||
if (s.findn("WHA") != 7)
|
||||
if (s.findn("WHA") != 7) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s.findn("Revenge of the Monster SawFish") != -1)
|
||||
if (s.findn("Revenge of the Monster SawFish") != -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -295,11 +315,13 @@ bool test_18() {
|
||||
OS::get_singleton()->print("\t\"WHA\" is at %i pos.\n", s.findn("WHA"));
|
||||
OS::get_singleton()->print("\t\"Revenge of the Monster SawFish\" is at %i pos.\n", s.findn("Revenge of the Monster Truck"));
|
||||
|
||||
if (s.findn("WHA") != 7)
|
||||
if (s.findn("WHA") != 7) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s.findn("Revenge of the Monster SawFish") != -1)
|
||||
if (s.findn("Revenge of the Monster SawFish") != -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -346,8 +368,9 @@ bool test_22() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
OS::get_singleton()->print("\tString: \"%s\" as Int is %i\n", nums[i], String(nums[i]).to_int());
|
||||
|
||||
if (String(nums[i]).to_int() != num[i])
|
||||
if (String(nums[i]).to_int() != num[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -362,8 +385,9 @@ bool test_23() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
OS::get_singleton()->print("\tString: \"%s\" as Float is %f\n", nums[i], String(nums[i]).to_double());
|
||||
|
||||
if (ABS(String(nums[i]).to_double() - num[i]) > 0.00001)
|
||||
if (ABS(String(nums[i]).to_double() - num[i]) > 0.00001) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -381,8 +405,9 @@ bool test_24() {
|
||||
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])
|
||||
if (s.get_slice(",", i) != slices[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -938,26 +963,30 @@ bool test_31() {
|
||||
String a = "";
|
||||
success = a[0] == 0;
|
||||
OS::get_singleton()->print("Is 0 String[0]:, %s\n", success ? "OK" : "FAIL");
|
||||
if (!success)
|
||||
if (!success) {
|
||||
state = false;
|
||||
}
|
||||
|
||||
String b = "Godot";
|
||||
success = b[b.size()] == 0;
|
||||
OS::get_singleton()->print("Is 0 String[size()]:, %s\n", success ? "OK" : "FAIL");
|
||||
if (!success)
|
||||
if (!success) {
|
||||
state = false;
|
||||
}
|
||||
|
||||
const String c = "";
|
||||
success = c[0] == 0;
|
||||
OS::get_singleton()->print("Is 0 const String[0]:, %s\n", success ? "OK" : "FAIL");
|
||||
if (!success)
|
||||
if (!success) {
|
||||
state = false;
|
||||
}
|
||||
|
||||
const String d = "Godot";
|
||||
success = d[d.size()] == 0;
|
||||
OS::get_singleton()->print("Is 0 const String[size()]:, %s\n", success ? "OK" : "FAIL");
|
||||
if (!success)
|
||||
if (!success) {
|
||||
state = false;
|
||||
}
|
||||
|
||||
return state;
|
||||
};
|
||||
@@ -1146,11 +1175,13 @@ MainLoop *test() {
|
||||
int passed = 0;
|
||||
|
||||
while (true) {
|
||||
if (!test_funcs[count])
|
||||
if (!test_funcs[count]) {
|
||||
break;
|
||||
}
|
||||
bool pass = test_funcs[count]();
|
||||
if (pass)
|
||||
if (pass) {
|
||||
passed++;
|
||||
}
|
||||
OS::get_singleton()->print("\t%s\n", pass ? "PASS" : "FAILED");
|
||||
|
||||
count++;
|
||||
|
||||
Reference in New Issue
Block a user