tests/test_func6.R

func6 <- function(x){
  
  tryCatch(stopifnot(is.numeric(x)), error=function(e){print("not numeric")})
  tryCatch(stopifnot(is.finite(x)), error=function(e){print("not finite")})
  tryCatch(stopifnot(length(x)!=0), error=function(e){print("has 0 length")})
  tryCatch(stopifnot(!is.nan(x)), error=function(e){print("NA or NAN")})
  tryCatch(stopifnot(!is.na(x)), error=function(e){print("NA or NAN")})
  
}
func6(2)
func6('a')
func6(Inf)
func6(c(1,2,3))
func6(NaN)
func6(NA)
sidoniazinky/Zinky004Tools documentation built on May 26, 2019, 4:32 a.m.