From b2948bd64d5a9b0401db1729968cd53c15e3f9a6 Mon Sep 17 00:00:00 2001 From: Danielle Callan Date: Mon, 22 Jan 2024 11:48:19 -0500 Subject: [PATCH] add some tests for NodeId and NodeIdList --- tests/testthat/test-nodes.R | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/testthat/test-nodes.R b/tests/testthat/test-nodes.R index 19ba6cd..52bdf4d 100644 --- a/tests/testthat/test-nodes.R +++ b/tests/testthat/test-nodes.R @@ -1,3 +1,18 @@ +test_that("NodeId works", { + expect_equal(class(NodeId('A'))[1], 'NodeId') +}) + +test_that("NodeIdList works", { + expect_equal(class(NodeIdList(list(NodeId('A'), NodeId('B'))))[1], 'NodeIdList') + expect_equal(class(NodeIdList(list('A', 'B')))[1], 'NodeIdList') + expect_equal(class(NodeIdList(list(Node(id=NodeId('A')))))[1], 'NodeIdList') + expect_equal(class(NodeIdList(Node(id=NodeId('A'))))[1], 'NodeIdList') + expect_equal(class(NodeIdList(list(Node(id=NodeId('A')), Node(id=NodeId('B')))))[1], 'NodeIdList') + + expect_error(NodeIdList(S4Vectors::SimpleList(c(NodeId('A'), 'B')))) + expect_error(NodeIdList(S4Vectors::SimpleList(c('A', 'B')))) +}) + test_that("Node methods work", { # Create a node