PageRenderTime 55ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/inst/tests/test-is-atomic-recursive-vector.R

https://bitbucket.org/fmark/assertive
R | 126 lines | 100 code | 26 blank | 0 comment | 0 complexity | 1a7259a190b6e5598ac052d404aa983b MD5 | raw file
  1. test.is_atomic.logical.returns_true <- function()
  2. {
  3. checkTrue(is_atomic(logical()))
  4. }
  5. test.is_atomic.integer.returns_true <- function()
  6. {
  7. checkTrue(is_atomic(integer()))
  8. }
  9. test.is_atomic.numeric.returns_true <- function()
  10. {
  11. checkTrue(is_atomic(numeric()))
  12. }
  13. test.is_atomic.complex.returns_true <- function()
  14. {
  15. checkTrue(is_atomic(complex()))
  16. }
  17. test.is_atomic.raw.returns_true <- function()
  18. {
  19. checkTrue(is_atomic(raw()))
  20. }
  21. test.is_atomic.matrix.returns_true <- function()
  22. {
  23. checkTrue(is_atomic(matrix()))
  24. }
  25. test.is_atomic.array.returns_true <- function()
  26. {
  27. checkTrue(is_atomic(array()))
  28. }
  29. test.is_atomic.null.returns_true <- function()
  30. {
  31. checkTrue(is_atomic(NULL))
  32. }
  33. test.is_atomic.something_recursive.returns_false <- function()
  34. {
  35. checkTrue(!is_atomic(list()))
  36. }
  37. test.is_recursive.a_list.returns_true <- function()
  38. {
  39. checkTrue(is_recursive(list()))
  40. }
  41. test.is_recursive.an_expression.returns_true <- function()
  42. {
  43. checkTrue(is_recursive(expression()))
  44. }
  45. test.is_recursive.a_data.frame.returns_true <- function()
  46. {
  47. checkTrue(is_recursive(data.frame()))
  48. }
  49. test.is_recursive.a_formula.returns_true <- function()
  50. {
  51. checkTrue(is_recursive(y ~ x))
  52. }
  53. test.is_recursive.a_function.returns_true <- function()
  54. {
  55. checkTrue(is_recursive(function(){}))
  56. }
  57. test.is_recursive.a_call.returns_true <- function()
  58. {
  59. checkTrue(is_recursive(call("sin", "pi")))
  60. }
  61. test.is_recursive.something_atomic.returns_false <- function()
  62. {
  63. checkTrue(!is_recursive(1:10))
  64. }
  65. test.is_vector.logical.returns_true <- function()
  66. {
  67. checkTrue(is_vector(logical()))
  68. }
  69. test.is_vector.integer.returns_true <- function()
  70. {
  71. checkTrue(is_vector(integer()))
  72. }
  73. test.is_vector.numeric.returns_true <- function()
  74. {
  75. checkTrue(is_vector(numeric()))
  76. }
  77. test.is_vector.complex.returns_true <- function()
  78. {
  79. checkTrue(is_vector(complex()))
  80. }
  81. test.is_vector.character.returns_true <- function()
  82. {
  83. checkTrue(is_vector(character()))
  84. }
  85. test.is_vector.raw.returns_true <- function()
  86. {
  87. checkTrue(is_vector(raw()))
  88. }
  89. test.is_vector.list.returns_true <- function()
  90. {
  91. checkTrue(is_vector(list()))
  92. }
  93. test.is_vector.expression.returns_true <- function()
  94. {
  95. checkTrue(is_vector(expression()))
  96. }
  97. test.is_vector.not_a_vector.returns_false <- function()
  98. {
  99. checkTrue(!is_vector(matrix()))
  100. }