Commit e9afe727 authored by David Schleef's avatar David Schleef
Browse files

tests: Add test for greatest common divisor

parent 037efe87
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment