MCPcopy Create free account
hub / github.com/FastLED/FastLED / test_scalar_multiply_impl

Function test_scalar_multiply_impl

tests/fl/math/fixed_point.cpp:488–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486
487template<typename T>
488void test_scalar_multiply_impl() {
489 T a(1.5f);
490
491 // fp * scalar
492 T b = a * 2;
493 FL_CHECK_EQ(b.to_int(), 3);
494 FL_CHECK_EQ(b.raw(), a.raw() * 2);
495
496 // scalar * fp (commutative friend)
497 T c = 2 * a;
498 FL_CHECK_EQ(c.raw(), b.raw());
499
500 // Multiply by 1
501 FL_CHECK_EQ((a * 1).raw(), a.raw());
502
503 // Multiply by 0
504 FL_CHECK_EQ((a * 0).raw(), raw_t<T>(0));
505}
506
507template<typename T>
508void test_right_shift_impl() {

Callers

nothing calls this directly

Calls 2

to_intMethod · 0.45
rawMethod · 0.45

Tested by

no test coverage detected