PageRenderTime 42ms CodeModel.GetById 20ms app.highlight 3ms RepoModel.GetById 17ms app.codeStats 0ms

/src/test/interpolator_test.c

http://ftk.googlecode.com/
C | 34 lines | 27 code | 7 blank | 0 comment | 1 complexity | f8e65a9b400f2f6ac567338788d39dbe MD5 | raw file
 1#include "ftk.h"
 2#include "ftk_interpolator_bounce.h"
 3#include "ftk_interpolator_linear.h"
 4#include "ftk_interpolator_accelerate.h"
 5#include "ftk_interpolator_decelerate.h"
 6#include "ftk_interpolator_acc_decelerate.h"
 7
 8static void test_interpolator(const char* name, FtkInterpolator* interpolator)
 9{
10	float percent = 0;
11	
12	ftk_logd("=========================%s==========================\n", name);
13	for(percent = 0; percent < 1.05; percent += 0.05)
14	{
15		printf("%f --> %f\n", percent, ftk_interpolator_get(interpolator, percent));
16	}
17
18	ftk_interpolator_destroy(interpolator);
19
20	return;
21}
22
23int main(int argc, char* argv[])
24{
25	ftk_set_allocator(ftk_allocator_default_create());
26	
27	test_interpolator("linear", ftk_interpolator_linear_create());
28	test_interpolator("bounce", ftk_interpolator_bounce_create());
29	test_interpolator("accelerate", ftk_interpolator_accelerate_create());
30	test_interpolator("decelerate", ftk_interpolator_decelerate_create());
31	test_interpolator("acc_decelerate", ftk_interpolator_acc_decelerate_create());
32
33	return 0;
34}