From 42fec04eb56d981a4eeb468c3f952363d31a0452 Mon Sep 17 00:00:00 2001 From: Stefan Widgren Date: Sat, 2 Nov 2019 10:17:21 +0100 Subject: [PATCH] code style: line length <= 80 characters --- tests/tree.R | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/tests/tree.R b/tests/tree.R index 3ddb5b5..c703239 100644 --- a/tests/tree.R +++ b/tests/tree.R @@ -1,4 +1,4 @@ -## Copyright 2013-2014 Stefan Widgren and Maria Noremark, +## Copyright 2013-2019 Stefan Widgren and Maria Noremark, ## National Veterinary Institute, Sweden ## ## Licensed under the EUPL, Version 1.1 or - as soon they @@ -28,19 +28,30 @@ library(EpiContactTrace) ## Case 1 ## tree <- structure(list( - node = c("O", "E", "F", "N", "A", "D", "G", "M", "B", "C", "H", "I", "J", "K", "L"), - parent = c(NA, "O", "O", "O", "E", "E", "N", "N", "D", "D", "M", "M", "M", "M", "M"), + node = c("O", "E", "F", "N", "A", "D", "G", "M", + "B", "C", "H", "I", "J", "K", "L"), + parent = c(NA, "O", "O", "O", "E", "E", "N", "N", + "D", "D", "M", "M", "M", "M", "M"), level = c(0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3)), - .Names = c("node", "parent", "level"), - row.names = c(NA, -15L), class = "data.frame") -tree.exp <- structure(list( - node = c("O", "E", "F", "N", "A", "D", "G", "M", "B", "C", "H", "I", "J", "K", "L"), - parent = c(NA, "O", "O", "O", "E", "E", "N", "N", "D", "D", "M", "M", "M", "M", "M"), + .Names = c("node", "parent", "level"), + row.names = c(NA, -15L), + class = "data.frame") + +tree_exp <- structure(list( + node = c("O", "E", "F", "N", "A", "D", "G", "M", + "B", "C", "H", "I", "J", "K", "L"), + parent = c(NA, "O", "O", "O", "E", "E", "N", "N", + "D", "D", "M", "M", "M", "M", "M"), level = c(0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3), - x = c(0, -10.5, 0, 10.5, -13.5, -7.5, 7.5, 13.5, -10.5, -4.5, 1.5, 7.5, 13.5, 19.5, 25.5), - y = c(0, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3)), - .Names = c("node", "parent", "level", "x", "y"), row.names = c(NA, -15L), class = "data.frame") -tree.obs <- EpiContactTrace:::position_tree(tree) -tree.obs$level <- as.numeric(tree.obs$level) -str(tree.obs) -stopifnot(identical(tree.obs, tree.exp)) + x = c(0, -10.5, 0, 10.5, -13.5, -7.5, 7.5, 13.5, + -10.5, -4.5, 1.5, 7.5, 13.5, 19.5, 25.5), + y = c(0, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, + -3, -3, -3, -3)), + .Names = c("node", "parent", "level", "x", "y"), + row.names = c(NA, -15L), + class = "data.frame") + +tree_obs <- EpiContactTrace:::position_tree(tree) +tree_obs$level <- as.numeric(tree_obs$level) +str(tree_obs) +stopifnot(identical(tree_obs, tree_exp))