X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=test%2Fdata%2Fdecoder.cpp;h=4ea4b10ff50f6231313c9aa8f9f341c13f2d7dd7;hp=641064da23f56dd8786f40a3c853a54bc9f6f33b;hb=b6b267bba9d55d23fe5c3537e4785238d4377ad7;hpb=3045c869ada2e32bf55cbb68633b5213b9b11e28 diff --git a/test/data/decoder.cpp b/test/data/decoder.cpp index 641064da..4ea4b10f 100644 --- a/test/data/decoder.cpp +++ b/test/data/decoder.cpp @@ -23,9 +23,10 @@ #include +#include "../../pv/data/decoder.h" #include "../../pv/devicemanager.h" #include "../../pv/sigsession.h" -#include "../../pv/view/signal.h" +#include "../../pv/view/decodesignal.h" using namespace boost; using namespace std; @@ -34,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); @@ -52,14 +55,32 @@ 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, + map > probes; + ss.add_decoder(dec, probes, g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify)g_variant_unref))); - - BOOST_CHECK (ss.add_decoder(dec, probes, + (GDestroyNotify)g_variant_unref)); + + ss.add_decoder(dec, probes, g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify)g_variant_unref))); + (GDestroyNotify)g_variant_unref)); + + // 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(); + + // Check there were no errors + BOOST_CHECK_EQUAL(dec0->error_message().isEmpty(), true); + BOOST_CHECK_EQUAL(dec1->error_message().isEmpty(), true); }