X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=test%2Fdata%2Fdecoder.cpp;h=6a48fb04709637f636db6989d8045170e5253d40;hb=ce94e4fd5d7ab666259231d21759613f1f2b93ee;hp=8ea5d181b73eb4f3d97ff3eab5f10500136db68e;hpb=3b3a445c072df27ae4e1831f6078467d84baa425;p=pulseview.git diff --git a/test/data/decoder.cpp b/test/data/decoder.cpp index 8ea5d18..6a48fb0 100644 --- a/test/data/decoder.cpp +++ b/test/data/decoder.cpp @@ -18,15 +18,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - #include /* First, so we avoid a _POSIX_C_SOURCE warning. */ +#include #include +#include "../../pv/data/decoder.h" #include "../../pv/devicemanager.h" #include "../../pv/sigsession.h" -#include "../../pv/view/signal.h" +#include "../../pv/view/decodetrace.h" using namespace boost; using namespace std; @@ -35,6 +35,8 @@ BOOST_AUTO_TEST_SUITE(DecoderTest) BOOST_AUTO_TEST_CASE(TwoDecoder) { + using namespace pv; + sr_context *ctx = NULL; BOOST_REQUIRE(sr_init(&ctx) == SR_OK); @@ -53,14 +55,26 @@ BOOST_AUTO_TEST_CASE(TwoDecoder) srd_decoder *const dec = (struct srd_decoder*)l->data; BOOST_REQUIRE(dec); - map > probes; - BOOST_CHECK (ss.add_decoder(dec, probes, - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify)g_variant_unref))); + ss.add_decoder(dec); + ss.add_decoder(dec); + + // Check the signals were created + const vector< shared_ptr > sigs = + ss.get_decode_signals(); + + shared_ptr dec0 = sigs[0]->decoder(); + BOOST_REQUIRE(dec0); + + shared_ptr dec1 = sigs[0]->decoder(); + BOOST_REQUIRE(dec1); + + // Wait for the decode threads to complete + dec0->_decode_thread.join(); + dec1->_decode_thread.join(); - BOOST_CHECK (ss.add_decoder(dec, probes, - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify)g_variant_unref))); + // Check there were no errors + BOOST_CHECK_EQUAL(dec0->error_message().isEmpty(), true); + BOOST_CHECK_EQUAL(dec1->error_message().isEmpty(), true); }