mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
tests: Add test for greatest common divisor
This commit is contained in:
parent
037efe8738
commit
e9afe72710
1 changed files with 23 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue