45 lines
922 B
C++
45 lines
922 B
C++
#pragma once
|
|
|
|
#include "mtl/test.hpp"
|
|
|
|
#include "mtl/fixed.hpp"
|
|
|
|
namespace mtl {
|
|
|
|
namespace test {
|
|
|
|
class fixed_suite : public suite<fixed_suite> {
|
|
public:
|
|
fixed_suite() {
|
|
add_test(&construction, "construction");
|
|
add_test(&addition, "addition");
|
|
add_test(&subtraction, "subtraction");
|
|
add_test(&multiplication, "multiplication");
|
|
add_test(&mult_overflow, "mult_overflow");
|
|
add_test(&division, "division");
|
|
}
|
|
|
|
virtual string_view name() {
|
|
return "fixed_suite";
|
|
}
|
|
|
|
static bool construction() {
|
|
start_timer();
|
|
bool r = fixed(7).raw() == 7 * 64;
|
|
end_timer();
|
|
return r;
|
|
}
|
|
|
|
// All tests are placed in IWRAM in ARM mode.
|
|
GBA_IWRAM ARM_MODE static bool addition();
|
|
GBA_IWRAM ARM_MODE static bool subtraction();
|
|
GBA_IWRAM ARM_MODE static bool multiplication();
|
|
GBA_IWRAM ARM_MODE static bool mult_overflow();
|
|
GBA_IWRAM ARM_MODE static bool division();
|
|
};
|
|
|
|
} // namespace test
|
|
|
|
} // namespace mtl
|
|
|