Commit Graph

17 Commits

Author SHA1 Message Date
Gerhard Sittig 081aaebfc7 tests: add (negative) "." test case for rational conversion
A naive implementation of the parse rational conversion helper could
have accepted invalid input. Check for the expected conversion failure.
2018-07-22 16:36:15 +02:00
Gerhard Sittig 74d915331a 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.
2018-07-22 16:36:15 +02:00
Gerhard Sittig 83a05ca9b3 tests: echo text input when rational conversion fails
The previous implementation only echoed the p/q conversion results _if_
the return code signalled success but the result was unexpected. Although
the errno value for failed conversion attempts (non-zero return codes)
is not too helpful, seeing which text input failed the test is desirable.
2018-07-22 16:36:15 +02:00
Frank Stettner 7ca40d2d1c tests: Tests for the locale independent sr_vsprintf_ascii() function. 2018-06-01 15:46:17 +02:00
Frank Stettner d8df3c2a01 tests: Fix incomplete fail message for locale tests. 2018-02-21 11:37:19 +01:00
Uwe Hermann d9b716fc5f Use UINT64_C instead of "ULL" number suffix.
Avoid hardcoding a "ULL" number suffix, use the more portable and more
correct UINT64_C.
2018-02-20 20:03:21 +01:00
Frank Stettner 16e88c6b93 tests: Tests for the locale independent sr_vsnprintf_ascii() function. 2018-02-11 23:15:52 +01:00
Stefan Brüns 41c47f2c6a strutil: Fix sr_parse_rational for integral parts between -0 and -1
Values like '-0.1' would be parsed as being positive, as the integral
type does not discern +0 and -0. Also allow values without leading
integral value, to match behaviour of strtod/sr_atof.
2017-09-24 21:04:46 +02:00
Uwe Hermann b5df922e4f sr_voltage_string(): Add a space before the unit.
This makes the output consistent with most of the other functions
in libsigrok.
2017-08-06 19:45:45 +02:00
Uwe Hermann c911599da7 Add sr_voltage_string() unit tests. 2017-08-06 19:38:31 +02:00
Soeren Apel 6984cfb245 Rework sr_period_string 2017-03-07 17:13:46 +01:00
Stefan Brüns 5223412ebe tests/strutil: Check output of sr_period_string 2017-01-21 15:08:21 +01:00
Gerhard Sittig 2ea1fdf121 license: remove FSF postal address from boiler plate license text
Remove the FSF postal address as it might change (it did in the past).
Reference the gnu.org website instead which is more stable.
2017-01-07 16:05:39 +01:00
Stefan Brüns 5ec172d7e9 strutil: add method to get an sr_rational from a string
The method accepts strings with numbers in scientific or normal notation,
e.g. -1.25 or 3.37e-6. The numeric range is limited by the sr_rational
range, i.e +-9.2e18, resolution is ~19 digits.
2016-05-16 23:35:10 +02:00
Daniel Elstner 6ec6c43b47 Build: Include <config.h> first in all source files
Since Autoconf places some important feature flags only into the
configuration header, it is necessary to include it globally to
guarantee a consistent build.
2015-09-13 18:54:46 +02:00
Daniel Elstner 4960aeb035 tests: Include <libsigrok/libsigrok.h>
This matches the global style and avoids the "../" path
components.
2015-08-16 18:28:13 +02:00
Uwe Hermann 02a2bf688f unit tests: Drop unneeded check_ filename prefix. 2015-02-17 15:24:28 +01:00
Renamed from tests/check_strutil.c (Browse further)