Add tests for movement vectors that are completely out of frame.

This commit is contained in:
Ari Koivula 2013-10-11 14:08:56 +03:00
parent 0df974cb0d
commit b155d825be

View file

@ -64,7 +64,7 @@ void sad_teardown(void)
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// TESTS // OVERLAPPING BOUNDARY TESTS
void test_topleft(void) void test_topleft(void)
{ {
assert_ulong_equal( assert_ulong_equal(
@ -128,6 +128,65 @@ void test_bottomright(void)
TEST_SAD(3, 3)); TEST_SAD(3, 3));
} }
//////////////////////////////////////////////////////////////////////////
// OUT OF FRAME TESTS
void test_topleft_out(void)
{
assert_ulong_equal(
1*(8*8) - 64,
TEST_SAD(-8, -8));
}
void test_top_out(void)
{
assert_ulong_equal(
(1+3)*8 + 2*(6*8) - 64,
TEST_SAD(0, -8));
}
void test_topright_out(void)
{
assert_ulong_equal(
3*(8*8) - 64,
TEST_SAD(8, -8));
}
void test_left_out(void)
{
assert_ulong_equal(
(1+7)*8 + 4*(6*8) - 64,
TEST_SAD(-8, 0));
}
void test_right_out(void)
{
assert_ulong_equal(
(3+9)*8 + 6*(6*8) - 64,
TEST_SAD(8, 0));
}
void test_bottomleft_out(void)
{
assert_ulong_equal(
7*(8*8) - 64,
TEST_SAD(-8, 8));
}
void test_bottom_out(void)
{
assert_ulong_equal(
(7+9)*8 + 8*(6*8) - 64,
TEST_SAD(0, 8));
}
void test_bottomright_out(void)
{
assert_ulong_equal(
9*(8*8) - 64,
TEST_SAD(8, 8));
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// TEST FIXTURES // TEST FIXTURES
void sad_tests(void) void sad_tests(void)
@ -135,6 +194,8 @@ void sad_tests(void)
test_fixture_start(); test_fixture_start();
fixture_setup(sad_setup); fixture_setup(sad_setup);
// Tests for movement vectors that overlap frame.
run_test(test_topleft); run_test(test_topleft);
run_test(test_top); run_test(test_top);
run_test(test_topright); run_test(test_topright);
@ -147,6 +208,19 @@ void sad_tests(void)
run_test(test_bottom); run_test(test_bottom);
run_test(test_bottomright); run_test(test_bottomright);
// Tests for movement vectors that are outside the frame.
run_test(test_topleft_out);
run_test(test_top_out);
run_test(test_topright_out);
run_test(test_left_out);
run_test(test_right_out);
run_test(test_bottomleft_out);
run_test(test_bottom_out);
run_test(test_bottomright_out);
fixture_teardown(sad_teardown); fixture_teardown(sad_teardown);
test_fixture_end(); test_fixture_end();
} }