X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=test%2Fdata%2Fdecoder.cpp;h=6a48fb04709637f636db6989d8045170e5253d40;hb=ce94e4fd5d7ab666259231d21759613f1f2b93ee;hp=4a74c417e0d4ac467dfbc7de2b5ac13448b09aa7;hpb=6ab7877549ced42972b4f4f648e363e544cd1c7d;p=pulseview.git diff --git a/test/data/decoder.cpp b/test/data/decoder.cpp index 4a74c41..6a48fb0 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/decodetrace.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,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); }