summaryrefslogtreecommitdiff
path: root/gruel/src/lib/pmt/unv_qa_template.cc.t
diff options
context:
space:
mode:
authorjcorgan2009-07-26 20:01:02 +0000
committerjcorgan2009-07-26 20:01:02 +0000
commit2bf2a8f2d2a4477818bfa91cae64fb663fdf88c3 (patch)
treed646b7851ed0ea3015c3480609d03d5589ebd60d /gruel/src/lib/pmt/unv_qa_template.cc.t
parent970d850297cf945943528557127db2cd327c3f3c (diff)
downloadgnuradio-2bf2a8f2d2a4477818bfa91cae64fb663fdf88c3.tar.gz
gnuradio-2bf2a8f2d2a4477818bfa91cae64fb663fdf88c3.tar.bz2
gnuradio-2bf2a8f2d2a4477818bfa91cae64fb663fdf88c3.zip
Merged r11491:11494 from jcorgan/pmt into trunk.
Moves pmt types functions into pmt:: from gruel:: Trunk passes distcheck. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11495 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gruel/src/lib/pmt/unv_qa_template.cc.t')
-rw-r--r--gruel/src/lib/pmt/unv_qa_template.cc.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/gruel/src/lib/pmt/unv_qa_template.cc.t b/gruel/src/lib/pmt/unv_qa_template.cc.t
new file mode 100644
index 000000000..1e2c8e8eb
--- /dev/null
+++ b/gruel/src/lib/pmt/unv_qa_template.cc.t
@@ -0,0 +1,35 @@
+void
+qa_pmt_unv::test_@TAG@vector()
+{
+ static const size_t N = 3;
+ pmt_t v1 = pmt_make_@TAG@vector(N, 0);
+ CPPUNIT_ASSERT_EQUAL(N, pmt_length(v1));
+ @TYPE@ s0 = @TYPE@(10);
+ @TYPE@ s1 = @TYPE@(20);
+ @TYPE@ s2 = @TYPE@(30);
+
+ pmt_@TAG@vector_set(v1, 0, s0);
+ pmt_@TAG@vector_set(v1, 1, s1);
+ pmt_@TAG@vector_set(v1, 2, s2);
+
+ CPPUNIT_ASSERT_EQUAL(s0, pmt_@TAG@vector_ref(v1, 0));
+ CPPUNIT_ASSERT_EQUAL(s1, pmt_@TAG@vector_ref(v1, 1));
+ CPPUNIT_ASSERT_EQUAL(s2, pmt_@TAG@vector_ref(v1, 2));
+
+ CPPUNIT_ASSERT_THROW(pmt_@TAG@vector_ref(v1, N), pmt_out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt_@TAG@vector_set(v1, N, @TYPE@(0)), pmt_out_of_range);
+
+ size_t len;
+ const @TYPE@ *rd = pmt_@TAG@vector_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ CPPUNIT_ASSERT_EQUAL(s0, rd[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, rd[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, rd[2]);
+
+ @TYPE@ *wr = pmt_@TAG@vector_writable_elements(v1, len);
+ CPPUNIT_ASSERT_EQUAL(len, N);
+ wr[0] = @TYPE@(0);
+ CPPUNIT_ASSERT_EQUAL(@TYPE@(0), wr[0]);
+ CPPUNIT_ASSERT_EQUAL(s1, wr[1]);
+ CPPUNIT_ASSERT_EQUAL(s2, wr[2]);
+}