awtk/tests/velocity_test.cc
2018-06-27 13:46:42 +08:00

16 lines
339 B
C++

#include "base/velocity.h"
#include "gtest/gtest.h"
#include <math.h>
TEST(Velocity, basic) {
velocity_t velocity;
velocity_t* v = velocity_reset(&velocity);
velocity_update(v, 100, 0, 0);
velocity_update(v, 110, 10, 20);
velocity_update(v, 120, 20, 40);
ASSERT_EQ(round(v->xv), 1000);
ASSERT_EQ(round(v->yv), 2000);
}