tests/testthat/test-repeat.R

test_that( "repeat operators work", {
    
  expect_equal( "--" %x=% 10, paste(rep("-", 20), collapse = "") )
  expect_equal( "-+" %x=% 10, paste(rep("-+", 10), collapse = ""))
	
	expect_equal( nchar("--" %x=|% 50), 50  )
	expect_equal( nchar("|-<+>-|" %x=|% 50), 50)
	expect_equal( "|-<+>-|" %x=|% 50, substring(paste(rep("|-<+>-|", 10), collapse = "" ), 0, 50) )
  
})

Try the operators package in your browser

Any scripts or data that you put into this service are public.

operators documentation built on May 2, 2019, 2:47 p.m.