Bruno Allaire-Lemay
/
APP1test
df
Fork of APP1 by
Diff: TestUtility.cpp
- Revision:
- 18:a21199781d20
- Parent:
- 15:b38d9d210e32
- Child:
- 21:a111be2582be
--- a/TestUtility.cpp Tue Jan 17 06:03:41 2017 +0000 +++ b/TestUtility.cpp Tue Jan 17 19:45:02 2017 +0000 @@ -13,6 +13,7 @@ test_update_bit(); test_update_bit_for_values_greater_than_one_byte(); test_update_bits(); + test_moving_average_filter(); } void test_is_almost_equal() @@ -67,4 +68,14 @@ assert(0x00 == update_bits(0x00, 0, 3, 0x00000000, 0x0F)); assert(0x00 == update_bits(0x00, 1, 4, 0x00000000, 0x0F)); } + + void test_moving_average_filter() + { + MovingAverageFilter filter(5); + assert(1 == filter.calculate(5)); + assert(2 == filter.calculate(5)); + assert(3 == filter.calculate(5)); + assert(4 == filter.calculate(5)); + assert(5 == filter.calculate(5)); + } } \ No newline at end of file