From eb13dcee7c2e7c6ba85c4ed6712d043b7345a0fd Mon Sep 17 00:00:00 2001 From: MLMecham Date: Thu, 19 Feb 2026 15:29:47 -0700 Subject: [PATCH 1/2] Added some cool tests. --- DESCRIPTION | 3 +++ tests/testthat.R | 12 ++++++++++++ tests/testthat/test-absolute.R | 8 ++++++++ 3 files changed, 23 insertions(+) create mode 100644 tests/testthat.R create mode 100644 tests/testthat/test-absolute.R diff --git a/DESCRIPTION b/DESCRIPTION index d655fc4..feea3ea 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..d51538f --- /dev/null +++ b/tests/testthat.R @@ -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") diff --git a/tests/testthat/test-absolute.R b/tests/testthat/test-absolute.R new file mode 100644 index 0000000..78f6c51 --- /dev/null +++ b/tests/testthat/test-absolute.R @@ -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) +}) From d96c73cb047761ece6da871b790a4af608db8a16 Mon Sep 17 00:00:00 2001 From: MLMecham Date: Thu, 19 Feb 2026 15:34:44 -0700 Subject: [PATCH 2/2] cool message --- tests/testthat/setup.r | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/testthat/setup.r diff --git a/tests/testthat/setup.r b/tests/testthat/setup.r new file mode 100644 index 0000000..4138878 --- /dev/null +++ b/tests/testthat/setup.r @@ -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() +)