1context("geom-point") 2 3test_that("single strings translate to their corresponding integers", { 4 expect_equal(translate_shape_string("square open"), 0) 5}) 6 7test_that("vectors of strings translate to corresponding integers", { 8 shape_strings <- c( 9 "square open", 10 "circle open", 11 "square open", 12 "triangle open" 13 ) 14 15 expect_equal(translate_shape_string(shape_strings), c(0, 1, 0, 2)) 16}) 17 18test_that("single characters are not translated to integers", { 19 expect_equal(translate_shape_string(letters), letters) 20 expect_equal(translate_shape_string(as.character(0:9)), as.character(0:9)) 21}) 22 23test_that("invalid shape names raise an error", { 24 expect_error(translate_shape_string("void"), "Can't find shape name") 25 expect_error(translate_shape_string("tri"), "Shape names must be unambiguous") 26}) 27