| 40 | using namespace osvr::common; |
| 41 | |
| 42 | TEST(addDevice, normalConditions) { |
| 43 | PathTree tree; |
| 44 | PathNode *dev = nullptr; |
| 45 | ASSERT_NO_THROW(dev = &addDevice(tree, "/com_osvr_sample/MyDevice")); |
| 46 | |
| 47 | // Check Device |
| 48 | ASSERT_EQ(dev->getName(), "MyDevice"); |
| 49 | ASSERT_FALSE(dev->hasChildren()) << "Make sure it has no children."; |
| 50 | ASSERT_TRUE(isNodeType<elements::DeviceElement>(*dev)) << "Check type"; |
| 51 | ASSERT_NE(dev->getParent(), nullptr) << "Make sure it has a parent."; |
| 52 | |
| 53 | // Check com_osvr_sample |
| 54 | auto plugin = dev->getParent(); |
| 55 | ASSERT_EQ(plugin->getName(), "com_osvr_sample"); |
| 56 | ASSERT_TRUE(isNodeType<elements::PluginElement>(*plugin)) << "Check type"; |
| 57 | ASSERT_NE(plugin->getParent(), nullptr) << "Make sure it has a parent."; |
| 58 | auto root = plugin->getParent(); |
| 59 | |
| 60 | ASSERT_TRUE(root->isRoot()); |
| 61 | ASSERT_EQ(tree.getNodeByPath("/"), *root) |
| 62 | << "Root identity should be preserved"; |
| 63 | ASSERT_EQ(tree.getNodeByPath("/com_osvr_sample/MyDevice"), *dev) |
| 64 | << "Identity should be preserved"; |
| 65 | } |
| 66 | |
| 67 | TEST(addDevice, missingLeadingSlash) { |
| 68 | PathTree tree; |
nothing calls this directly
no test coverage detected