summaryrefslogtreecommitdiff
path: root/gruel/src/lib/pmt/unv_qa_template.cc.t
diff options
context:
space:
mode:
authorManoj Gudi2013-10-07 20:19:55 +0530
committerManoj Gudi2013-10-07 20:20:35 +0530
commit1826d0763c8595997f5f4af1fdb0354e9c0998ad (patch)
treeacbd852cd5a1bf17241b1038b5e37a0e72e64612 /gruel/src/lib/pmt/unv_qa_template.cc.t
parent452defdb4a78e9e826740ddf4b9673e926c568a4 (diff)
parent24b640997ba7fee0c725e65f401f5cbebdab8d08 (diff)
downloadgnuradio-1826d0763c8595997f5f4af1fdb0354e9c0998ad.tar.gz
gnuradio-1826d0763c8595997f5f4af1fdb0354e9c0998ad.tar.bz2
gnuradio-1826d0763c8595997f5f4af1fdb0354e9c0998ad.zip
README change
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]);
+}