mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-02 00:00:26 +02:00
Reformat the code, using:
find -type f | # list all regular files grep -E '\.(h|cpp|mm)$' | # filter for source files grep -v '/mt_' | # filter out generated files grep -v '/vendor/' | # and vendored GL grep -v '/test/image_loader_test.cpp' | # and this file (has giant literals arrays) xargs -n 1 -P $(nproc) clang-format -i # reformat everything Co-authored-by: numzero <numzer0@yandex.ru>
This commit is contained in:
@ -4,13 +4,14 @@
|
||||
using namespace irr;
|
||||
using core::array;
|
||||
|
||||
static void test_basics() {
|
||||
static void test_basics()
|
||||
{
|
||||
array<int> v;
|
||||
v.push_back(1); // 1
|
||||
v.push_back(1); // 1
|
||||
v.push_front(2); // 2, 1
|
||||
v.insert(4, 0); // 4, 2, 1
|
||||
v.insert(3, 1); // 4, 3, 2, 1
|
||||
v.insert(0, 4); // 4, 3, 2, 1, 0
|
||||
v.insert(4, 0); // 4, 2, 1
|
||||
v.insert(3, 1); // 4, 3, 2, 1
|
||||
v.insert(0, 4); // 4, 3, 2, 1, 0
|
||||
UASSERTEQ(v.size(), 5);
|
||||
UASSERTEQ(v[0], 4);
|
||||
UASSERTEQ(v[1], 3);
|
||||
@ -57,7 +58,8 @@ static void test_basics() {
|
||||
UASSERTEQ(v.size(), 2);
|
||||
}
|
||||
|
||||
static void test_linear_searches() {
|
||||
static void test_linear_searches()
|
||||
{
|
||||
// Populate the array with 0, 1, 2, ..., 100, 100, 99, 98, 97, ..., 0
|
||||
array<int> arr;
|
||||
for (int i = 0; i <= 100; i++)
|
||||
@ -75,14 +77,15 @@ static void test_linear_searches() {
|
||||
}
|
||||
}
|
||||
|
||||
static void test_binary_searches() {
|
||||
const auto& values = { 3, 5, 1, 2, 5, 10, 19, 9, 7, 1, 2, 5, 8, 15 };
|
||||
static void test_binary_searches()
|
||||
{
|
||||
const auto &values = {3, 5, 1, 2, 5, 10, 19, 9, 7, 1, 2, 5, 8, 15};
|
||||
array<int> arr;
|
||||
for (int value : values) {
|
||||
arr.push_back(value);
|
||||
}
|
||||
// Test the const form first, it uses a linear search without sorting
|
||||
const array<int> & carr = arr;
|
||||
const array<int> &carr = arr;
|
||||
UASSERTEQ(carr.binary_search(20), -1);
|
||||
UASSERTEQ(carr.binary_search(0), -1);
|
||||
UASSERTEQ(carr.binary_search(1), 2);
|
||||
|
Reference in New Issue
Block a user