summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp3
-rw-r--r--main/tests/test_astar.cpp24
-rw-r--r--main/tests/test_string.cpp12
3 files changed, 26 insertions, 13 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 95449dd5cc..b6afd9160c 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2260,7 +2260,8 @@ bool Main::iteration() {
uint64_t time_step = 1000000L / target_fps;
target_ticks += time_step;
uint64_t current_ticks = OS::get_singleton()->get_ticks_usec();
- if (current_ticks < target_ticks) OS::get_singleton()->delay_usec(target_ticks - current_ticks);
+ if (current_ticks < target_ticks)
+ OS::get_singleton()->delay_usec(target_ticks - current_ticks);
current_ticks = OS::get_singleton()->get_ticks_usec();
target_ticks = MIN(MAX(target_ticks, current_ticks - time_step), current_ticks + time_step);
}
diff --git a/main/tests/test_astar.cpp b/main/tests/test_astar.cpp
index e0b4a7f2c8..66f9aa8ad6 100644
--- a/main/tests/test_astar.cpp
+++ b/main/tests/test_astar.cpp
@@ -173,7 +173,8 @@ bool test_add_remove() {
for (int i = 0; i < 20000; i++) {
int u = Math::rand() % 5;
int v = Math::rand() % 4;
- if (u == v) v = 4;
+ if (u == v)
+ v = 4;
if (Math::rand() % 2 == 1) {
// Add a (possibly existing) directed edge and confirm connectivity
a.connect_points(u, v, false);
@@ -195,7 +196,8 @@ bool test_add_remove() {
for (int j = 0; j < 10; j++) {
int u = Math::rand() % 5;
int v = Math::rand() % 4;
- if (u == v) v = 4;
+ if (u == v)
+ v = 4;
if (Math::rand() % 2 == 1)
a.connect_points(u, v, false);
else
@@ -239,7 +241,8 @@ bool test_solutions() {
int u, v;
u = Math::rand() % N;
v = Math::rand() % (N - 1);
- if (u == v) v = N - 1;
+ if (u == v)
+ v = N - 1;
// Pick a random operation
int op = Math::rand();
@@ -253,14 +256,16 @@ bool test_solutions() {
// Add edge (u, v); possibly bidirectional
a.connect_points(u, v, op % 2);
adj[u][v] = true;
- if (op % 2) adj[v][u] = true;
+ if (op % 2)
+ adj[v][u] = true;
break;
case 6:
case 7:
// Remove edge (u, v); possibly bidirectional
a.disconnect_points(u, v, op % 2);
adj[u][v] = false;
- if (op % 2) adj[v][u] = false;
+ if (op % 2)
+ adj[v][u] = false;
break;
case 8:
// Remove point u and add it back; clears adjacent edges and changes coordinates
@@ -291,12 +296,14 @@ bool test_solutions() {
int count = 0;
for (int u = 0; u < N; u++)
for (int v = 0; v < N; v++)
- if (adj[u][v]) count++;
+ if (adj[u][v])
+ count++;
printf("Test #%4d: %3d edges, ", test + 1, count);
count = 0;
for (int u = 0; u < N; u++)
for (int v = 0; v < N; v++)
- if (!Math::is_inf(d[u][v])) count++;
+ if (!Math::is_inf(d[u][v]))
+ count++;
printf("%3d/%d pairs of reachable points\n", count - N, N * (N - 1));
// Check A*'s output
@@ -339,7 +346,8 @@ bool test_solutions() {
}
exit:
- if (!match) return false;
+ if (!match)
+ return false;
}
return true;
}
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index 7438e2bae9..34087c7204 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -972,22 +972,26 @@ bool test_31() {
String a = "";
success = a[0] == 0;
OS::get_singleton()->print("Is 0 String[0]:, %s\n", success ? "OK" : "FAIL");
- if (!success) state = false;
+ 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) state = false;
+ 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) state = false;
+ 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) state = false;
+ if (!success)
+ state = false;
return state;
};