unittests/runit.errorfunctions.R

###############################################
# test "assertClass"
###############################################

test.assertClass <- function()
{
	assertClass <- RNMImport:::assertClass
	errorCheck <- try(assertClass(1:10, "character") , silent = TRUE)
	checkEquals(class(errorCheck), "try-error" , msg = " |Untrue assertion generates error")
	checkTrue( length(grep(errorCheck, pattern = "Error : 1:10 is not of class character" ) ) > 0 )
	res <- try(assertClass(0.01, "numeric"), silent = TRUE)
	checkTrue(!inherits(res, "try-error"))
}

# test that RNMImportStop generates exceptions with the appropriate message

test.RNMImportStop <- function()
{
	errorCheck <- try(RNMImport:::RNMImportStop("Exception correctly generated:"), silent = TRUE)
	checkEquals(class(errorCheck), "try-error" , msg = " |RNMImportStop generates error")
	checkTrue( length( grep( errorCheck, pattern = "Error : Exception correctly generated:" )) > 0,
	 msg = " |Correct error message generated by RNMImportStop"  )
	# checkException(RNMImportStop("Exception correctly generated:"), match.call())
	
}

test.RNMImportWarning <- function()
{
	
}
MarioGS/NMI documentation built on May 7, 2019, 2:51 p.m.