Skip to content

Commit

Permalink
Add a find relative path test
Browse files Browse the repository at this point in the history
  • Loading branch information
locka99 committed Jul 13, 2021
1 parent 0df9576 commit 2ce4c01
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion server/src/tests/address_space.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use crate::{
address_space::{
references::Reference, relative_path::find_node_from_browse_path, EventNotifier,
references::Reference,
relative_path::{find_node_from_browse_path, find_nodes_relative_path_simple},
EventNotifier,
},
callbacks,
prelude::*,
Expand Down Expand Up @@ -507,6 +509,25 @@ fn browse_nodes() {
assert_eq!(result.unwrap_err(), StatusCode::BadNotFound);
}

#[test]
fn find_nodes_relative_path() {
let address_space = make_sample_address_space();
let address_space = trace_read_lock_unwrap!(address_space);

// Given some paths, find the nodes
let parent_node = ObjectId::RootFolder.into();

let relative_path = "/Objects/Server.ServerStatus.BuildInfo.ProductName";

let results =
find_nodes_relative_path_simple(&address_space, &parent_node, relative_path).unwrap();
assert_eq!(results.len(), 1);
assert_eq!(
results[0],
VariableId::Server_ServerStatus_BuildInfo_ProductName.into()
);
}

#[test]
fn object_builder() {
let mut address_space = AddressSpace::new();
Expand Down

0 comments on commit 2ce4c01

Please sign in to comment.