MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / TEST

Function TEST

tests/cplusplus/Routing/AddDevice.cpp:42–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40using namespace osvr::common;
41
42TEST(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
67TEST(addDevice, missingLeadingSlash) {
68 PathTree tree;

Callers

nothing calls this directly

Calls 4

getNameMethod · 0.80
hasChildrenMethod · 0.80
getParentMethod · 0.80
isRootMethod · 0.80

Tested by

no test coverage detected