Commit Graph

56 Commits

Author SHA1 Message Date
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
Uwe Hermann ba7dd8bbb8 Replace 'probe' with 'channel' in most places.
Also, consistently use 'ch' for channel variables. This matches how we
consistently use sdi, devc, and so on all over the code-base.

This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 91aea754aa Rename 'struct sr_probe' to 'struct sr_channel' everywhere.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 67bd805523 Switch to a non-recursive automake setup.
Instead of >= 44 Makefile.am's we now only have one top-level
Makefile.am, and use the 'subdir-objects' automake option to
handle the build via non-recursive (auto)make.

This has the advantage of fewer (boilerplate or other) files and less
clutter in general, as well as performance advantages since the new
setup can build many files in parallel (with 'make -j'), not only 2 or 3
files within the same (e.g. hardware/xxxx/* subdirectory) and also since
we no longer need to build intermediate libtool helper libs per subdirectory.

A quick, non-scientific test build on a quad-core laptop with 'make -j 4'
yields a build time reduction from 35s to 19s.

All autotools features that worked before are still intact without any
regressions, including the Make targets 'install', 'uninstall', 'check',
'dist', 'clean', 'distclean' and so on, as well as all the usual portability
handling (build works on any OS, with any Make implementation such as
GNU Make or BSD Make, with any shell such as sh/ksh/zsh/bash/dash, etc. etc.)
and features such as out-of-tree build support, cross-compile support,
testsuite support (also with colored output), "silent make rules", etc. etc.
2014-03-20 13:10:05 +01:00
Uwe Hermann 17794067f9 tests: Fix a few warnings.
Fix a bunch of "no previous prototype for ..." warnings exposed
by -Wmissing-prototypes.
2014-01-17 20:49:45 +01:00
Marvin Schmidt c3e2b08dc9 Fix test failure
The GError object has to initialized to NULL before being passed to
g_file_set_contents or it will throw the following critical warning

GLib-CRITICAL **: g_file_set_contents: assertion 'error == NULL || *error == NULL' failed

and return FALSE, which leads to failed assertion and subsequently
to the test failing
2013-12-07 12:25:18 +01:00
Uwe Hermann 57d0a2e195 unittests: Update for probe-groups changes. 2013-11-10 23:22:18 +01:00