##### Earn extra honor and gain new allies!

Honor is earned for each new codewarrior who joins.

Learn more`#you wouldn't put this part in example tests, just in the hidden tests solution <- function(x){ x**2 } test_that("example", { expect_equal(func(2), 4) expect_equal(func(3), 9) #etc. #or expect_equal(func(c(1:100)), solution(c(1:100))) })`

1 + #you wouldn't put this part in example tests, just in the hidden tests 2 + solution <- function(x){ 3 + x**2 4 + } 5 + 1 1 test_that("example", { 2 2 expect_equal(func(2), 4) 3 3 expect_equal(func(3), 9) 4 4 #etc. 10 + #or 11 + expect_equal(func(c(1:100)), solution(c(1:100))) 5 5 })

`#problem with asking to plot something is that all plot() functions will return the same thing, so all you'd need to do would be plot([anything]) # a better test would be asking to write a function that just returned the square of what was given func <- function(x){ x**2 }`

1 - #?????? 2 - func <- function(){ 3 - x <- c(1:10) 4 - plot(x,x**2) 1 + #problem with asking to plot something is that all plot() functions will return the same thing, so all you'd need to do would be plot([anything]) 2 + # a better test would be asking to write a function that just returned the square of what was given 3 + func <- function(x){ 4 + x**2 5 5 }

`test_that("example", { expect_equal(func(2), 4) expect_equal(func(3), 9) #etc. })`

1 1 test_that("example", { 2 - expect_equal(func(), plot(c(1:10),c(1:10)**2)) 2 + expect_equal(func(2), 4) 3 + expect_equal(func(3), 9) 4 + #etc. 3 3 })

`#?????? func <- function(){ x <- c(1:10) plot(x,x**2) }`

1 - print("Hellow") 2 - #THis doesnt work becasue R is not supported yet 1 + #?????? 2 + func <- function(){ 3 + x <- c(1:10) 4 + plot(x,x**2) 5 + }

`test_that("example", { expect_equal(func(), plot(c(1:10),c(1:10)**2)) })`

1 - 1 + test_that("example", { 2 + expect_equal(func(), plot(c(1:10),c(1:10)**2)) 3 + })