2024-07-13 23:58:29 +08:00
|
|
|
#pragma once
|
|
|
|
|
2024-07-14 01:46:54 +08:00
|
|
|
#include <test/core.hpp>
|
|
|
|
#include <irrt/utils.hpp>
|
2024-07-13 23:58:29 +08:00
|
|
|
|
|
|
|
void test_int_log_10() {
|
|
|
|
BEGIN_TEST();
|
|
|
|
|
|
|
|
assert_values_match((uint32_t) 0, int_log_floor(0, 10));
|
|
|
|
assert_values_match((uint32_t) 0, int_log_floor(9, 10));
|
|
|
|
assert_values_match((uint32_t) 1, int_log_floor(10, 10));
|
|
|
|
assert_values_match((uint32_t) 1, int_log_floor(11, 10));
|
|
|
|
assert_values_match((uint32_t) 1, int_log_floor(99, 10));
|
|
|
|
assert_values_match((uint32_t) 2, int_log_floor(100, 10));
|
|
|
|
assert_values_match((uint32_t) 2, int_log_floor(101, 10));
|
|
|
|
}
|
|
|
|
|
|
|
|
void test_cstr_utils() {
|
|
|
|
BEGIN_TEST();
|
|
|
|
|
|
|
|
assert_values_match((uint32_t) 42, (uint32_t) cstr_utils::length("THROWN FROM __nac3_error_dummy_raise!!!!!!"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void run_test_utils() {
|
|
|
|
test_int_log_10();
|
|
|
|
test_cstr_utils();
|
|
|
|
}
|