From: Gerhard Sittig Date: Mon, 16 Jul 2018 19:19:36 +0000 (+0200) Subject: tests: add more cases for text to rational number conversion X-Git-Url: http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=74d915331a41d521eb48edf5f734a1ea2ec82df9 tests: add more cases for text to rational number conversion Test the ".1" and "1." cases which are assumed to be problematic on MacOS (or may not have been supported before a recent update). Add more tests with leading signs as well as whitespace instead of a sign. --- diff --git a/tests/strutil.c b/tests/strutil.c index 14240f04..82856f1d 100644 --- a/tests/strutil.c +++ b/tests/strutil.c @@ -388,6 +388,13 @@ START_TEST(test_fractional) test_rational("+.1", (struct sr_rational){1, 10}); test_rational("-0.1", (struct sr_rational){-1, 10}); test_rational("-.1", (struct sr_rational){-1, 10}); + test_rational(".1", (struct sr_rational){1, 10}); + test_rational(".123", (struct sr_rational){123, 1000}); + test_rational("1.", (struct sr_rational){1, 1}); + test_rational("123.", (struct sr_rational){123, 1}); + test_rational("-.1", (struct sr_rational){-1, 10}); + test_rational(" .1", (struct sr_rational){1, 10}); + test_rational("+.1", (struct sr_rational){1, 10}); } END_TEST