Commit Graph

45 Commits

Author SHA1 Message Date
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
Uwe Hermann 71185b48a1 Unit tests for 'binary' input format & version APIs. 2013-10-28 22:08:34 +01:00
Uwe Hermann 059f36325e unittests: Comment out a testcase.
The boundary test-case with SR_GHZ(18446744073ULL) currently fails, but
that is not practically relevant so comment it out for now, until we add
a proper fix.
2013-08-07 16:21:57 +02:00
Paul Sokolovsky ba253f2bb9 Fix sr_si_string_u64() test cases.
The function shall format 1004 as 1.004 k, 1004000 as 1.004 M and
1004000000 as 1.004 G.

References #73.
2013-08-07 16:21:57 +02:00
Uwe Hermann 44f91e2950 unittests: Disable a broken test for now. 2013-04-27 19:06:27 +02:00
Uwe Hermann 34e4c27391 unittests: Adapt to new GVariant system. 2013-04-12 17:59:38 +02:00
Uwe Hermann 79bb0e97d5 Add a testsuite for libsigrok.
This adds a suite of unit tests for libsigrok. It uses the 'Check'
tool/library (apt-get install check) to run the tests.

The configure tool tries to find libcheck. If it succeeds, a
"make check" will run all tests. Otherwise, none of the tests will
be built and "make check" will not run any tests.

This also means that users who don't have 'check' installed will still
be able to build and install libsigrok just fine.
2013-03-09 11:55:43 +01:00