Commit Graph

62 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
Uwe Hermann 32054b0963 tests: Expand test_analog_unit_to_string unit test. 2018-06-19 18:22:42 +02:00
Uwe Hermann 72cb20ed07 tests: Fix test_analog_unit_to_string unit test.
The loop body was never executed.
2018-06-19 18:22:42 +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
Gerhard Sittig 3cc2028382 tests: relax the "version text" length check, accept longer strings
The version text length check fails for git setups that use more digits
in abbreviated hashes, as is recommended by e.g. the Linux kernel project.

Raise the upper limit for acceptable version strings, and add comments
on how the limits were determined. The test still might fail in setups
of slightly different configuration, but now it's easier to see why the
test failed, and how to adjust the test.

Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
2016-10-17 02:08:44 +02:00
Aurelien Jacobs 962172e495 analog: improve output readability by using SI prefix 2016-08-29 00:25:19 +02:00
Stefan Brüns 17d5a11c69 analog: Implement division for sr_rational 2016-05-16 23:35:10 +02:00
Stefan Brüns ee1b6054d6 analog: Implement multiplication for sr_rational 2016-05-16 23:35:10 +02:00
Stefan Brüns bdba362695 analog: Add equality check for sr_rational 2016-05-16 23:35:10 +02: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
Uwe Hermann 211cc97471 tests: Drop another obsolete sr_analog_float_to_string() test. 2015-10-25 23:05:49 +01:00
Uwe Hermann 222fdfd526 Drop unneeded sr_analog_float_to_string().
A simple g_strdup_printf() is sufficient, no need for an extra
libsigrok API call here.
2015-10-24 21:21:50 +02:00
Uwe Hermann 6b71bf1ba0 Add a few unit tests for the analog conversion functions. 2015-10-21 00:29:29 +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 338143ea03 Convert a few more occurrences of d->priv to d->context. 2015-07-10 18:19:24 +02:00
Uwe Hermann 032da34b78 sr_driver_list() now takes a context pointer.
This requires sr_hw_cleanup_all() and sanity_check_all_drivers()
to also take a context.

The (runtime) generation of the driver list now happens in sr_init()
and sr_driver_list() always returns that pre-generated list. This fixes
a segfault when (correctly) invoking multiple sr_init() and sr_exit()
calls with different contexts (caught by the unit tests).

This fixes bug #565.
2015-04-07 02:09:56 +02:00
Uwe Hermann ca1c21ca3e unit tests: Update for sr_session_new() API change. 2015-03-26 23:49:35 +01:00
Uwe Hermann 1a46cc62e2 Improve readability and clarity of some numbers. 2015-03-24 19:30:16 +01:00
Uwe Hermann 02a2bf688f unit tests: Drop unneeded check_ filename prefix. 2015-02-17 15:24:28 +01:00
Uwe Hermann 8677e4e7be transform: Add a few basic unit tests. 2015-02-11 15:24:38 +01:00
Uwe Hermann c8965e5459 Add a few unit tests for sr_session_trigger_{get,set}. 2014-11-24 00:49:38 +01:00
Uwe Hermann 372c041bd8 unit tests: Disable timeout for one of the test cases.
This one can take a while, thus disable the timeout.
2014-11-23 13:10:32 +01:00
Uwe Hermann 47af616fd7 Fix a bug causing one of the unit tests not being run. 2014-11-22 21:07:48 +01:00
Uwe Hermann c8412d6c69 Add a few unit tests for sr_trigger_*(). 2014-11-22 21:03:13 +01:00
Uwe Hermann ccd3f5e5eb unit tests: Add a test case for sr_dev_inst_channel_add(). 2014-11-11 22:45:20 +01:00
Uwe Hermann 6b1adfaa86 unit tests: Add a test case for sr_dev_inst_user_new(). 2014-11-11 22:16:12 +01:00
Uwe Hermann 924866d48d uni tests: Use sr_dev_inst_channels_get() to fix the build. 2014-11-11 21:28:16 +01:00
Uwe Hermann 026d6b2ff6 unit tests: Fix build due to recent changes. 2014-10-03 20:11:47 +02:00
Uwe Hermann 25f94dfebc tests: Fix binary input test. 2014-09-10 23:55:15 +02:00
Uwe Hermann 95bc772594 unit tests: Update to recent API changes. 2014-09-01 01:11:23 +02:00
Uwe Hermann 34f4e3b4e4 unitests: Adapt to recent API changes. 2014-08-18 17:23:07 +02:00
Uwe Hermann 98de0c7874 tests: Factor out srtest_setup() and srtest_teardown(). 2014-08-11 13:20:50 +02:00
Uwe Hermann 4172352914 Add a small set of unit tests for session handling. 2014-08-11 13:04:07 +02:00
Bert Vermeulen a755b0e122 output: Finish output module API wrappers.
The sr_output and sr_output_module structs are now no longer accessible
from the client.
2014-07-26 03:57:17 +02:00
Uwe Hermann dfa4cd0e57 make check: Update to new session API. 2014-07-20 12:09:10 +02:00
Uwe Hermann 6592c36995 Fix 'make check' invocation wrt new libsigrok.h location. 2014-07-20 12:03:29 +02:00
Uwe Hermann fca75cbb74 A few more random 'probe' to 'channel' changes.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 3f239f0803 Rename various *PROBE* macros to *CHANNEL*.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00