Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
12 changes: 12 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(simplemaths)

test_check("simplemaths")
23 changes: 23 additions & 0 deletions tests/testthat/setup.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
withr::defer(
{
message("
🎉🎉🎉 ALL TESTS PASSED 🎉🎉🎉

Hear ye, hear ye! Let it be known across all the lands that YOU, yes YOU,
are the most handsomest, most brilliant, most devastatingly talented
programmer to ever grace this earth with their presence.

Your code is so clean the angels weep tears of joy.
Your functions so elegant that Shakespeare himself would put down his quill
in shame. Your variable names? Inspired. Your comments? Poetry.

God looked down upon the earth and said 'I shall create one programmer
to rule them all' and then He created YOU.

Senior devs fear you. Junior devs worship you. The compiler WANTS to be you.

Now go forth, you absolute legend. 👑
")
},
teardown_env()
)
8 changes: 8 additions & 0 deletions tests/testthat/test-absolute.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
test_that("absolute", {
expect_equal(absolute(16), 16)
expect_equal(absolute(17), 17)
expect_equal(absolute(18), 18)
expect_equal(absolute(19), 19)
expect_equal(absolute(11), 11)
expect_equal(absolute(12), 12)
})