forked from M-Labs/nac3
27 lines
782 B
C++
27 lines
782 B
C++
#pragma once
|
|
|
|
#include <test/core.hpp>
|
|
#include <irrt/utils.hpp>
|
|
|
|
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();
|
|
} |