Skip to content

Commit 35b9960

Browse files
committed
Add test for turtleSet()
1 parent 753c11f commit 35b9960

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/testthat/test-turtle-functions.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,15 @@ test_that("turtleSet works", {
12961296
var = "who"
12971297
))))
12981298
expect_equivalent(of(agents = tAll, var = "sex"), c(rep(NA, 10), rep("F", 2), NA))
1299+
1300+
t6 <- createTurtles(n = 10, coords = randomXYcor(w1, n = 10))
1301+
t6 <- turtlesOwn(turtles = t6, tVar = "test", tVal = "a")
1302+
t7 <- NLwith(agents = t6, var = "who", val = 0:5)
1303+
t8 <- NLwith(agents = t6, var = "who", val = 6:7)
1304+
t9 <- NLwith(agents = t6, var = "who", val = 8:9)
1305+
t9 <- NLset(turtles = t9, agents = t9, var = "test", val = "b")
1306+
t10 <- turtleSet(t7, t8, t9) # create NA instead of showing "b"
1307+
expect_identical(of(agents = t10, var = "test"), c(rep("a", 8), rep("b", 2)))
12991308
})
13001309

13011310
test_that("turtlesOwn works", {

0 commit comments

Comments
 (0)