summaryrefslogtreecommitdiff
path: root/pmt/src/lib/qa_pmt_prims.cc
diff options
context:
space:
mode:
authoreb2009-07-15 01:23:38 +0000
committereb2009-07-15 01:23:38 +0000
commit25d7580a42fbde01763e3634a6c2f3f7b51438a7 (patch)
tree670c588c8edd173736bab001cd7f7abeb783a01b /pmt/src/lib/qa_pmt_prims.cc
parent4eca9fb849d88274f57167fb8023772e5fe24624 (diff)
downloadgnuradio-25d7580a42fbde01763e3634a6c2f3f7b51438a7.tar.gz
gnuradio-25d7580a42fbde01763e3634a6c2f3f7b51438a7.tar.bz2
gnuradio-25d7580a42fbde01763e3634a6c2f3f7b51438a7.zip
Add some unit test for pmt_subsetp and pmt_memq. (c1261 from Stefan BrĂ¼ns)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11438 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'pmt/src/lib/qa_pmt_prims.cc')
-rw-r--r--pmt/src/lib/qa_pmt_prims.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/pmt/src/lib/qa_pmt_prims.cc b/pmt/src/lib/qa_pmt_prims.cc
index 57db4a1a9..39cf9ce46 100644
--- a/pmt/src/lib/qa_pmt_prims.cc
+++ b/pmt/src/lib/qa_pmt_prims.cc
@@ -413,3 +413,24 @@ qa_pmt_prims::test_serialize()
// FIXME add tests for malformed input too.
}
+
+void
+qa_pmt_prims::test_sets()
+{
+ pmt_t s1 = pmt_intern("s1");
+ pmt_t s2 = pmt_intern("s2");
+ pmt_t s3 = pmt_intern("s3");
+
+ pmt_t l1 = pmt_list1(s1);
+ pmt_t l2 = pmt_list2(s2,s3);
+ pmt_t l3 = pmt_list3(s1,s2,s3);
+
+ CPPUNIT_ASSERT(pmt_is_pair(pmt_memq(s1,l1)));
+ CPPUNIT_ASSERT(pmt_is_false(pmt_memq(s3,l1)));
+
+ CPPUNIT_ASSERT(pmt_subsetp(l1,l3));
+ CPPUNIT_ASSERT(pmt_subsetp(l2,l3));
+ CPPUNIT_ASSERT(!pmt_subsetp(l1,l2));
+ CPPUNIT_ASSERT(!pmt_subsetp(l2,l1));
+ CPPUNIT_ASSERT(!pmt_subsetp(l3,l2));
+}