2024-10-28 15:57:39 +01:00
|
|
|
// Luanti
|
|
|
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
// Copyright (C) 2022 Minetest Authors
|
2022-05-06 13:17:16 -07:00
|
|
|
|
|
|
|
#include "benchmark/benchmark.h"
|
|
|
|
|
2024-06-07 17:58:36 +02:00
|
|
|
#define CATCH_CONFIG_ENABLE_BENCHMARKING
|
|
|
|
#include "catch.h"
|
2022-05-06 13:17:16 -07:00
|
|
|
|
2023-12-14 11:41:22 +01:00
|
|
|
bool run_benchmarks(const char *arg)
|
2022-05-06 13:17:16 -07:00
|
|
|
{
|
2023-12-14 11:41:22 +01:00
|
|
|
const char *const argv[] = {
|
|
|
|
"MinetestBenchmark", arg, nullptr
|
|
|
|
};
|
|
|
|
const int argc = arg ? 2 : 1;
|
2022-05-06 13:17:16 -07:00
|
|
|
int errCount = Catch::Session().run(argc, argv);
|
2023-12-14 11:41:22 +01:00
|
|
|
return errCount == 0;
|
2022-05-06 13:17:16 -07:00
|
|
|
}
|