From 45736504ec2e56ceb61a863e66555be54493883c Mon Sep 17 00:00:00 2001 From: Colin Leach Date: Tue, 28 Jul 2026 15:25:38 -0700 Subject: [PATCH] Re-sync practice exercises --- exercises/practice/bob/.meta/tests.toml | 89 ++++++------ exercises/practice/bob/test_bob.R | 129 +++++++++--------- .../perfect-numbers/.meta/config.json | 2 +- .../swift-scheduling/.meta/tests.toml | 3 + .../swift-scheduling/test_swift-scheduling.R | 9 +- 5 files changed, 125 insertions(+), 107 deletions(-) diff --git a/exercises/practice/bob/.meta/tests.toml b/exercises/practice/bob/.meta/tests.toml index 5299e289..c6a46496 100644 --- a/exercises/practice/bob/.meta/tests.toml +++ b/exercises/practice/bob/.meta/tests.toml @@ -9,17 +9,20 @@ # As user-added comments (using the # character) will be removed when this file # is regenerated, comments can be added via a `comment` key. -[e162fead-606f-437a-a166-d051915cea8e] -description = "stating something" +[8a2e771d-d6f1-4e3f-b6c6-b41495556e37] +description = "asking a question" [73a966dc-8017-47d6-bb32-cf07d1a5fcd9] description = "shouting" -[d6c98afd-df35-4806-b55e-2c457c3ab748] -description = "shouting gibberish" +[a5193c61-4a92-4f68-93e2-f554eb385ec6] +description = "forceful question" -[8a2e771d-d6f1-4e3f-b6c6-b41495556e37] -description = "asking a question" +[bc39f7c6-f543-41be-9a43-fd1c2f753fc0] +description = "silence" + +[e162fead-606f-437a-a166-d051915cea8e] +description = "stating something" [81080c62-4e4d-4066-b30a-48d8d76920d9] description = "asking a numeric question" @@ -27,23 +30,34 @@ description = "asking a numeric question" [2a02716d-685b-4e2e-a804-2adaf281c01e] description = "asking gibberish" -[c02f9179-ab16-4aa7-a8dc-940145c385f7] -description = "talking forcefully" +[bb0011c5-cd52-4a5b-8bfb-a87b6283b0e2] +description = "question with no letters" -[153c0e25-9bb5-4ec5-966e-598463658bcd] -description = "using acronyms in regular speech" +[9bfc677d-ea3a-45f2-be44-35bc8fa3753e] +description = "non-letters with question" -[a5193c61-4a92-4f68-93e2-f554eb385ec6] -description = "forceful question" +[8608c508-f7de-4b17-985b-811878b3cf45] +description = "prattling on" -[a20e0c54-2224-4dde-8b10-bd2cdd4f61bc] -description = "shouting numbers" +[05b304d6-f83b-46e7-81e0-4cd3ca647900] +description = "ending with whitespace" -[f7bc4b92-bdff-421e-a238-ae97f230ccac] -description = "no letters" +[66953780-165b-4e7e-8ce3-4bcb80b6385a] +description = "multiple line question" +include = false -[bb0011c5-cd52-4a5b-8bfb-a87b6283b0e2] -description = "question with no letters" +[2c7278ac-f955-4eb4-bf8f-e33eb4116a15] +description = "multiple line question" +reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a" + +[d6c98afd-df35-4806-b55e-2c457c3ab748] +description = "shouting gibberish" + +[3c954328-86fb-4c71-8961-e18d6a5e2517] +description = "shouting a statement containing a question mark" + +[a20e0c54-2224-4dde-8b10-bd2cdd4f61bc] +description = "shouting numbers" [496143c8-1c31-4c01-8a08-88427af85c66] description = "shouting with special characters" @@ -51,40 +65,29 @@ description = "shouting with special characters" [e6793c1c-43bd-4b8d-bc11-499aea73925f] description = "shouting with no exclamation mark" -[aa8097cc-c548-4951-8856-14a404dd236a] -description = "statement containing question mark" - -[9bfc677d-ea3a-45f2-be44-35bc8fa3753e] -description = "non-letters with question" - -[8608c508-f7de-4b17-985b-811878b3cf45] -description = "prattling on" - -[bc39f7c6-f543-41be-9a43-fd1c2f753fc0] -description = "silence" - [d6c47565-372b-4b09-b1dd-c40552b8378b] description = "prolonged silence" [4428f28d-4100-4d85-a902-e5a78cb0ecd3] description = "alternate silence" -[66953780-165b-4e7e-8ce3-4bcb80b6385a] -description = "multiple line question" -include = false +[72bd5ad3-9b2f-4931-a988-dce1f5771de2] +description = "other whitespace" -[5371ef75-d9ea-4103-bcfa-2da973ddec1b] -description = "starting with whitespace" +[c02f9179-ab16-4aa7-a8dc-940145c385f7] +description = "talking forcefully" -[05b304d6-f83b-46e7-81e0-4cd3ca647900] -description = "ending with whitespace" +[153c0e25-9bb5-4ec5-966e-598463658bcd] +description = "using acronyms in regular speech" -[72bd5ad3-9b2f-4931-a988-dce1f5771de2] -description = "other whitespace" +[f7bc4b92-bdff-421e-a238-ae97f230ccac] +description = "no letters" + +[aa8097cc-c548-4951-8856-14a404dd236a] +description = "statement containing question mark" + +[5371ef75-d9ea-4103-bcfa-2da973ddec1b] +description = "starting with whitespace" [12983553-8601-46a8-92fa-fcaa3bc4a2a0] description = "non-question ending with whitespace" - -[2c7278ac-f955-4eb4-bf8f-e33eb4116a15] -description = "multiple line question" -reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a" diff --git a/exercises/practice/bob/test_bob.R b/exercises/practice/bob/test_bob.R index 4ebcdf61..3e8b68b8 100644 --- a/exercises/practice/bob/test_bob.R +++ b/exercises/practice/bob/test_bob.R @@ -1,13 +1,13 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/bob/canonical-data.json -# File last updated on 2026-03-13 +# File last updated on 2026-07-28 source("./bob.R") library(testthat) -test_that("stating something", { - input <- "Tom-ay-to, tom-aaaah-to." - expect_equal(bob(input), "Whatever.") +test_that("asking a question", { + input <- "Does this cryogenic chamber make me look fat?" + expect_equal(bob(input), "Sure.") }) test_that("shouting", { @@ -15,14 +15,19 @@ test_that("shouting", { expect_equal(bob(input), "Whoa, chill out!") }) -test_that("shouting gibberish", { - input <- "FCECDFCAAB" - expect_equal(bob(input), "Whoa, chill out!") +test_that("forceful question", { + input <- "WHAT'S GOING ON?" + expect_equal(bob(input), "Calm down, I know what I'm doing!") }) -test_that("asking a question", { - input <- "Does this cryogenic chamber make me look fat?" - expect_equal(bob(input), "Sure.") +test_that("silence", { + input <- "" + expect_equal(bob(input), "Fine. Be that way!") +}) + +test_that("stating something", { + input <- "Tom-ay-to, tom-aaaah-to." + expect_equal(bob(input), "Whatever.") }) test_that("asking a numeric question", { @@ -35,34 +40,46 @@ test_that("asking gibberish", { expect_equal(bob(input), "Sure.") }) -test_that("talking forcefully", { - input <- "Hi there!" - expect_equal(bob(input), "Whatever.") +test_that("question with no letters", { + input <- "4?" + expect_equal(bob(input), "Sure.") }) -test_that("using acronyms in regular speech", { - input <- "It's OK if you don't want to go work for NASA." - expect_equal(bob(input), "Whatever.") +test_that("non-letters with question", { + input <- ":) ?" + expect_equal(bob(input), "Sure.") }) -test_that("forceful question", { - input <- "WHAT'S GOING ON?" - expect_equal(bob(input), "Calm down, I know what I'm doing!") +test_that("prattling on", { + input <- "Wait! Hang on. Are you going to be OK?" + expect_equal(bob(input), "Sure.") }) -test_that("shouting numbers", { - input <- "1, 2, 3 GO!" +test_that("ending with whitespace", { + input <- "Okay if like my spacebar quite a bit? " + expect_equal(bob(input), "Sure.") +}) + +test_that("multiple line question", { + input <- " +Does this cryogenic chamber make + me look fat?" + expect_equal(bob(input), "Sure.") +}) + +test_that("shouting gibberish", { + input <- "FCECDFCAAB" expect_equal(bob(input), "Whoa, chill out!") }) -test_that("no letters", { - input <- "1, 2, 3" - expect_equal(bob(input), "Whatever.") +test_that("shouting a statement containing a question mark", { + input <- "DO LIONS EAT PEOPLE? AHHHHH." + expect_equal(bob(input), "Whoa, chill out!") }) -test_that("question with no letters", { - input <- "4?" - expect_equal(bob(input), "Sure.") +test_that("shouting numbers", { + input <- "1, 2, 3 GO!" + expect_equal(bob(input), "Whoa, chill out!") }) test_that("shouting with special characters", { @@ -75,61 +92,49 @@ test_that("shouting with no exclamation mark", { expect_equal(bob(input), "Whoa, chill out!") }) -test_that("statement containing question mark", { - input <- "Ending with ? means a question." - expect_equal(bob(input), "Whatever.") +test_that("prolonged silence", { + input <- " " + expect_equal(bob(input), "Fine. Be that way!") }) -test_that("non-letters with question", { - input <- ":) ?" - expect_equal(bob(input), "Sure.") +test_that("alternate silence", { + input <- " " + expect_equal(bob(input), "Fine. Be that way!") }) -test_that("prattling on", { - input <- "Wait! Hang on. Are you going to be OK?" - expect_equal(bob(input), "Sure.") -}) +test_that("other whitespace", { + input <- " -test_that("silence", { - input <- "" + " expect_equal(bob(input), "Fine. Be that way!") }) -test_that("prolonged silence", { - input <- " " - expect_equal(bob(input), "Fine. Be that way!") +test_that("talking forcefully", { + input <- "Hi there!" + expect_equal(bob(input), "Whatever.") }) -test_that("alternate silence", { - input <- " " - expect_equal(bob(input), "Fine. Be that way!") +test_that("using acronyms in regular speech", { + input <- "It's OK if you don't want to go work for NASA." + expect_equal(bob(input), "Whatever.") }) -test_that("starting with whitespace", { - input <- " hmmmmmmm..." +test_that("no letters", { + input <- "1, 2, 3" expect_equal(bob(input), "Whatever.") }) -test_that("ending with whitespace", { - input <- "Okay if like my spacebar quite a bit? " - expect_equal(bob(input), "Sure.") +test_that("statement containing question mark", { + input <- "Ending with ? means a question." + expect_equal(bob(input), "Whatever.") }) -test_that("other whitespace", { - input <- " - - " - expect_equal(bob(input), "Fine. Be that way!") +test_that("starting with whitespace", { + input <- " hmmmmmmm..." + expect_equal(bob(input), "Whatever.") }) test_that("non-question ending with whitespace", { input <- "This is a statement ending with whitespace " expect_equal(bob(input), "Whatever.") }) - -test_that("multiple line question", { - input <- " -Does this cryogenic chamber make - me look fat?" - expect_equal(bob(input), "Sure.") -}) diff --git a/exercises/practice/perfect-numbers/.meta/config.json b/exercises/practice/perfect-numbers/.meta/config.json index a08f630e..35c07efd 100644 --- a/exercises/practice/perfect-numbers/.meta/config.json +++ b/exercises/practice/perfect-numbers/.meta/config.json @@ -19,5 +19,5 @@ }, "blurb": "Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers.", "source": "Taken from Chapter 2 of Functional Thinking by Neal Ford.", - "source_url": "https://www.oreilly.com/library/view/functional-thinking/9781449365509/" + "source_url": "https://nealford.com/books/functionalthinking.html" } diff --git a/exercises/practice/swift-scheduling/.meta/tests.toml b/exercises/practice/swift-scheduling/.meta/tests.toml index 7cc3e415..f2475c9e 100644 --- a/exercises/practice/swift-scheduling/.meta/tests.toml +++ b/exercises/practice/swift-scheduling/.meta/tests.toml @@ -56,3 +56,6 @@ description = "Q4 in the second quarter translates to the last workday of the fo [c920886c-44ad-4d34-a156-dc4176186581] description = "Q3 in the fourth quarter translates to the last workday of the third quarter of next year" + +[7c8f1616-be62-417e-bbd5-a60fa743eccc] +description = "Q2 starting in the last month of the second quarter translates to the last workday of the second quarter of this year" diff --git a/exercises/practice/swift-scheduling/test_swift-scheduling.R b/exercises/practice/swift-scheduling/test_swift-scheduling.R index 75d1f1da..8b10b095 100644 --- a/exercises/practice/swift-scheduling/test_swift-scheduling.R +++ b/exercises/practice/swift-scheduling/test_swift-scheduling.R @@ -1,6 +1,6 @@ # These tests are auto-generated with test data from: # https://github.com/exercism/problem-specifications/tree/main/exercises/swift-scheduling/canonical-data.json -# File last updated on 2026-04-20 +# File last updated on 2026-07-28 source("./swift-scheduling.R") library(testthat) @@ -116,3 +116,10 @@ test_that("Q3 in the fourth quarter translates to the last workday of the third expected <- "2023-09-29T08:00:00" expect_equal(delivery_date(start, description), expected) }) + +test_that("Q2 starting in the last month of the second quarter translates to the last workday of the second quarter of this year", { + start <- "2019-06-15T09:50:00" + description <- "Q2" + expected <- "2019-06-28T08:00:00" + expect_equal(delivery_date(start, description), expected) +})