tests: Add test for greatest common divisor

This commit is contained in:
David Schleef 2011-04-13 10:24:33 -07:00
parent 037efe8738
commit e9afe72710

View file

@ -1031,6 +1031,28 @@ GST_START_TEST (test_pad_proxy_getcaps_aggregation)
GST_END_TEST;
GST_START_TEST (test_greatest_common_divisor)
{
fail_if (gst_util_greatest_common_divisor (1, 1) != 1);
fail_if (gst_util_greatest_common_divisor (2, 3) != 1);
fail_if (gst_util_greatest_common_divisor (3, 5) != 1);
fail_if (gst_util_greatest_common_divisor (-1, 1) != 1);
fail_if (gst_util_greatest_common_divisor (-2, 3) != 1);
fail_if (gst_util_greatest_common_divisor (-3, 5) != 1);
fail_if (gst_util_greatest_common_divisor (-1, -1) != 1);
fail_if (gst_util_greatest_common_divisor (-2, -3) != 1);
fail_if (gst_util_greatest_common_divisor (-3, -5) != 1);
fail_if (gst_util_greatest_common_divisor (1, -1) != 1);
fail_if (gst_util_greatest_common_divisor (2, -3) != 1);
fail_if (gst_util_greatest_common_divisor (3, -5) != 1);
fail_if (gst_util_greatest_common_divisor (2, 2) != 2);
fail_if (gst_util_greatest_common_divisor (2, 4) != 2);
fail_if (gst_util_greatest_common_divisor (1001, 11) != 11);
}
GST_END_TEST;
static Suite *
gst_utils_suite (void)
{
@ -1063,6 +1085,7 @@ gst_utils_suite (void)
tcase_add_test (tc_chain, test_binary_search);
tcase_add_test (tc_chain, test_pad_proxy_getcaps_aggregation);
tcase_add_test (tc_chain, test_greatest_common_divisor);
return s;
}