From: David Schleef Date: Wed, 13 Apr 2011 17:24:33 +0000 (-0700) Subject: tests: Add test for greatest common divisor X-Git-Tag: RELEASE-0.10.33~62 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9afe72710ac8a74e8e8a0b3e90d0be2b129aa8f;p=platform%2Fupstream%2Fgstreamer.git tests: Add test for greatest common divisor --- diff --git a/tests/check/gst/gstutils.c b/tests/check/gst/gstutils.c index 22c3091..5324b14 100644 --- a/tests/check/gst/gstutils.c +++ b/tests/check/gst/gstutils.c @@ -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; }