[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4366 - gnuradio/branches/developers/eb/mb/mblock/src/
From: |
eb |
Subject: |
[Commit-gnuradio] r4366 - gnuradio/branches/developers/eb/mb/mblock/src/lib |
Date: |
Sat, 3 Feb 2007 20:15:43 -0700 (MST) |
Author: eb
Date: 2007-02-03 20:15:43 -0700 (Sat, 03 Feb 2007)
New Revision: 4366
Modified:
gnuradio/branches/developers/eb/mb/mblock/src/lib/qa_mblock_send.cc
Log:
work-in-progress on mblocks
Modified: gnuradio/branches/developers/eb/mb/mblock/src/lib/qa_mblock_send.cc
===================================================================
--- gnuradio/branches/developers/eb/mb/mblock/src/lib/qa_mblock_send.cc
2007-02-04 02:40:19 UTC (rev 4365)
+++ gnuradio/branches/developers/eb/mb/mblock/src/lib/qa_mblock_send.cc
2007-02-04 03:15:43 UTC (rev 4366)
@@ -37,7 +37,9 @@
#include <stdio.h>
static pmt_t s_data = pmt_intern("data");
-
+static pmt_t s_p0 = pmt_intern("p0");
+static pmt_t s_p1 = pmt_intern("p1");
+static pmt_t s_p2 = pmt_intern("p2");
static void
define_protocol_classes()
@@ -73,8 +75,15 @@
void
sr1::init_fsm()
{
- // FIXME send two messages to each port
- std::cout << fullname() << "[sr1]: init_fsm\n";
+ // std::cout << fullname() << "[sr1]: init_fsm\n";
+
+ // send two messages to each port
+ pmt_t our_name = pmt_intern(fullname());
+ d_p1->send(s_data, pmt_list3(our_name, s_p1, pmt_from_long(0)));
+ d_p1->send(s_data, pmt_list3(our_name, s_p1, pmt_from_long(1)));
+
+ d_p2->send(s_data, pmt_list3(our_name, s_p2, pmt_from_long(0)));
+ d_p2->send(s_data, pmt_list3(our_name, s_p2, pmt_from_long(1)));
}
// ----------------------------------------------------------------
@@ -94,20 +103,11 @@
{
d_p0 = define_port("p0", "simple-send", false, mb_port::INTERNAL);
- mb_mblock_sptr mb1;
- mb_mblock_sptr mb2;
- define_component("mb1", mb1 = mb_mblock_sptr(new sr1()));
- define_component("mb2", mb2 = mb_mblock_sptr(new sr1()));
+ define_component("mb1", mb_mblock_sptr(new sr1()));
+ define_component("mb2", mb_mblock_sptr(new sr1()));
connect("self", "p0", "mb1", "p1");
connect("mb1", "p2", "mb2", "p2");
-
- if (0){
- std::cout << '\n';
- std::cout << fullname() << '\n';
- std::cout << mb1->fullname() << '\n';
- std::cout << mb2->fullname() << '\n';
- }
}
sr0::~sr0(){}
@@ -115,8 +115,12 @@
void
sr0::init_fsm()
{
- // FIXME send two messages to p0
- std::cout << fullname() << "[sr0]: init_fsm\n";
+ // std::cout << fullname() << "[sr0]: init_fsm\n";
+
+ // send two messages to p0
+ pmt_t our_name = pmt_intern(fullname());
+ d_p0->send(s_data, pmt_list3(our_name, s_p0, pmt_from_long(0)));
+ d_p0->send(s_data, pmt_list3(our_name, s_p0, pmt_from_long(1)));
}
// ----------------------------------------------------------------
@@ -124,17 +128,29 @@
/*
* This tests basic message routing using INTERNAL and EXTERNAL ports.
* It does not rely on the guts of the runtime being complete,
- * which is good, because at the time this is being written, the runtime
- * is still a dream ;)
+ * which is good, because at the time this is being written, it isn't.
*/
void
qa_mblock_send::test_simple_routing()
{
define_protocol_classes();
- mb_mblock_sptr mb0 = mb_mblock_sptr(new sr0());
+ mb_message_sptr msg;
mb_runtime_sptr rt = mb_make_runtime();
+ mb_mblock_sptr mb0 = mb_mblock_sptr(new sr0());
rt->run(mb0);
+
+ // Reach into the guts and see if the messages ended up where they should
have
+
+ // mb0 should have received two messages sent from mb1 via its p1
+ msg = mb0->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ CPPUNIT_ASSERT_EQUAL(pmt_list3(pmt_intern("top/mb1"), s_p1,
pmt_from_long(0)),
+ msg->data());
+ msg = mb0->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ CPPUNIT_ASSERT_EQUAL(pmt_list3(pmt_intern("top/mb1"), s_p1,
pmt_from_long(1)),
+ msg->data());
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4366 - gnuradio/branches/developers/eb/mb/mblock/src/lib,
eb <=