@@ -34,6 +34,7 @@ using ola::rdm::UIDSet;
3434class UIDTest : public CppUnit ::TestFixture {
3535 CPPUNIT_TEST_SUITE (UIDTest);
3636 CPPUNIT_TEST (testUID);
37+ CPPUNIT_TEST (testRPTUID);
3738 CPPUNIT_TEST (testUIDInequalities);
3839 CPPUNIT_TEST (testUIDSet);
3940 CPPUNIT_TEST (testUIDSetUnion);
@@ -43,6 +44,7 @@ class UIDTest: public CppUnit::TestFixture {
4344
4445 public:
4546 void testUID ();
47+ void testRPTUID ();
4648 void testUIDInequalities ();
4749 void testUIDSet ();
4850 void testUIDSetUnion ();
@@ -58,6 +60,8 @@ CPPUNIT_TEST_SUITE_REGISTRATION(UIDTest);
5860 */
5961void UIDTest::testUID () {
6062 UID uid (1 , 2 );
63+ OLA_ASSERT_FALSE (uid.IsBroadcast ());
64+ OLA_ASSERT_FALSE (uid.IsVendorcast ());
6165 UID uid2 = uid;
6266 OLA_ASSERT_EQ (uid, uid2);
6367 OLA_ASSERT_FALSE (uid != uid2);
@@ -84,9 +88,12 @@ void UIDTest::testUID() {
8488
8589 UID all_devices = UID::AllDevices ();
8690 UID manufacturer_devices = UID::VendorcastAddress (0x52 );
91+ UID manufacturer_devices2 = UID::VendorcastAddress (uid);
8792 OLA_ASSERT_EQ (string (" ffff:ffffffff" ), all_devices.ToString ());
8893 OLA_ASSERT_EQ (string (" 0052:ffffffff" ),
8994 manufacturer_devices.ToString ());
95+ OLA_ASSERT_EQ (string (" 0001:ffffffff" ),
96+ manufacturer_devices2.ToString ());
9097 OLA_ASSERT_EQ (all_devices.ManufacturerId (),
9198 static_cast <uint16_t >(0xffff ));
9299 OLA_ASSERT_EQ (all_devices.DeviceId (),
@@ -95,8 +102,16 @@ void UIDTest::testUID() {
95102 static_cast <uint16_t >(0x0052 ));
96103 OLA_ASSERT_EQ (manufacturer_devices.DeviceId (),
97104 static_cast <uint32_t >(0xffffffff ));
105+ OLA_ASSERT_EQ (manufacturer_devices2.ManufacturerId (),
106+ static_cast <uint16_t >(0x0001 ));
107+ OLA_ASSERT_EQ (manufacturer_devices2.DeviceId (),
108+ static_cast <uint32_t >(0xffffffff ));
98109 OLA_ASSERT_TRUE (all_devices.IsBroadcast ());
110+ OLA_ASSERT_FALSE (all_devices.IsVendorcast ());
99111 OLA_ASSERT_TRUE (manufacturer_devices.IsBroadcast ());
112+ OLA_ASSERT_TRUE (manufacturer_devices.IsVendorcast ());
113+ OLA_ASSERT_TRUE (manufacturer_devices2.IsBroadcast ());
114+ OLA_ASSERT_TRUE (manufacturer_devices2.IsVendorcast ());
100115
101116 // now test the packing & unpacking
102117 unsigned int buffer_size = UID::UID_SIZE;
@@ -118,6 +133,49 @@ void UIDTest::testUID() {
118133}
119134
120135
136+ /*
137+ * Test the RPT UIDs work.
138+ */
139+ void UIDTest::testRPTUID () {
140+ UID uid (1 , 2 );
141+ UID rpt_all_controllers = UID::RPTAllControllers ();
142+ UID rpt_all_devices = UID::RPTAllDevices ();
143+ UID rpt_manufacturer_devices = UID::RPTVendorcastAddressDevices (0x52 );
144+ UID rpt_manufacturer_devices2 = UID::RPTVendorcastAddressDevices (uid);
145+ OLA_ASSERT_EQ (string (" fffc:ffffffff" ), rpt_all_controllers.ToString ());
146+ OLA_ASSERT_EQ (string (" fffd:ffffffff" ), rpt_all_devices.ToString ());
147+ OLA_ASSERT_EQ (string (" fffd:0052ffff" ),
148+ rpt_manufacturer_devices.ToString ());
149+ OLA_ASSERT_EQ (string (" fffd:0001ffff" ),
150+ rpt_manufacturer_devices2.ToString ());
151+ OLA_ASSERT_EQ (rpt_all_controllers.ManufacturerId (),
152+ static_cast <uint16_t >(0xfffc ));
153+ OLA_ASSERT_EQ (rpt_all_controllers.DeviceId (),
154+ static_cast <uint32_t >(0xffffffff ));
155+ OLA_ASSERT_EQ (rpt_all_devices.ManufacturerId (),
156+ static_cast <uint16_t >(0xfffd ));
157+ OLA_ASSERT_EQ (rpt_all_devices.DeviceId (),
158+ static_cast <uint32_t >(0xffffffff ));
159+ OLA_ASSERT_EQ (rpt_manufacturer_devices.ManufacturerId (),
160+ static_cast <uint16_t >(0xfffd ));
161+ OLA_ASSERT_EQ (rpt_manufacturer_devices.DeviceId (),
162+ static_cast <uint32_t >(0x0052ffff ));
163+ OLA_ASSERT_EQ (rpt_manufacturer_devices2.ManufacturerId (),
164+ static_cast <uint16_t >(0xfffd ));
165+ OLA_ASSERT_EQ (rpt_manufacturer_devices2.DeviceId (),
166+ static_cast <uint32_t >(0x0001ffff ));
167+ // TODO(Peter): Handle the more complicated RPT vendorcast tests
168+ OLA_ASSERT_TRUE (rpt_all_controllers.IsBroadcast ());
169+ // OLA_ASSERT_FALSE(rpt_all_controllers.IsVendorcast());
170+ OLA_ASSERT_TRUE (rpt_all_devices.IsBroadcast ());
171+ // OLA_ASSERT_FALSE(rpt_all_devices.IsVendorcast());
172+ // OLA_ASSERT_TRUE(rpt_manufacturer_devices.IsBroadcast());
173+ // OLA_ASSERT_TRUE(rpt_manufacturer_devices.IsVendorcast());
174+ // OLA_ASSERT_TRUE(rpt_manufacturer_devices2.IsBroadcast());
175+ // OLA_ASSERT_TRUE(rpt_manufacturer_devices2.IsVendorcast());
176+ }
177+
178+
121179/*
122180 * Test the UIDs inequalities work
123181 */
0 commit comments