Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests for pangram, roman-numerals, and triangle #246

Merged
merged 4 commits into from
Dec 29, 2023
Merged
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
5 changes: 5 additions & 0 deletions exercises/practice/pangram/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ description = "mixed case and punctuation"

[2577bf54-83c8-402d-a64b-a2c0f7bb213a]
description = "case insensitive"
include = false

[7138e389-83e4-4c6e-8413-1e40a0076951]
description = "a-m and A-M are 26 different characters but not a pangram"
reimplements = "2577bf54-83c8-402d-a64b-a2c0f7bb213a"
33 changes: 15 additions & 18 deletions exercises/practice/pangram/pangram.vader
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
"
" Version: 1.1.0
"

Before:
unlet! input expected

Execute (sentence empty):
Execute (empty sentence):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless this is coming from upstream, perhaps this should be phrase, since not all pangrams are sentences. (As evidenced by this empty "sentence". While it is probably accurate to describe this as an empty string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but that's the description upstream unfortunately. However, we have some leeway here as long as it's clear that "empty string" here is the "empty sentence" from the tests.toml. I think it's safe to make that tweak.

let input = ""
let expected = 0
AssertEqual expected, IsPangram(input)

Execute (pangram with only lower case):
Execute (perfect lower case):
let input = "abcdefghijklmnopqrstuvwxyz"
let expected = 1
AssertEqual expected, IsPangram(input)

Execute (only lower case):
let input = "the quick brown fox jumps over the lazy dog"
let expected = 1
AssertEqual expected, IsPangram(input)

Execute (missing character 'x'):
Execute (missing the letter 'x'):
let input = "a quick movement of the enemy will jeopardize five gunboats"
let expected = 0
AssertEqual expected, IsPangram(input)

Execute (another missing character 'x'):
let input = "the quick brown fish jumps over the lazy dog"
Execute (missing the letter 'h'):
let input = "five boxing wizards jump quickly at it"
let expected = 0
AssertEqual expected, IsPangram(input)

Execute (pangram with underscores):
Execute (with underscores):
let input = "the_quick_brown_fox_jumps_over_the_lazy_dog"
let expected = 1
AssertEqual expected, IsPangram(input)

Execute (pangram with numbers):
Execute (with numbers):
let input = "the 1 quick brown fox jumps over the 2 lazy dogs"
let expected = 1
AssertEqual expected, IsPangram(input)
Expand All @@ -40,13 +38,12 @@ Execute (missing letters replaced by numbers):
let expected = 0
AssertEqual expected, IsPangram(input)

Execute (pangram with mixed case and punctuation):
Execute (mixed case and punctuation):
let input = "\"Five quacking Zephyrs jolt my wax bed.\""
let expected = 1
AssertEqual expected, IsPangram(input)

Execute (upper and lower case versions of the same character should not be counted separately):
let input = "the quick brown fox jumps over with lazy FX"
Execute (a-m and A-M are 26 different characters but not a pangram):
let input = "abcdefghijklm ABCDEFGHIJKLM"
let expected = 0
AssertEqual expected, IsPangram(input)

21 changes: 21 additions & 0 deletions exercises/practice/roman-numerals/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ description = "6 is VI"
[ff3fb08c-4917-4aab-9f4e-d663491d083d]
description = "9 is IX"

[6d1d82d5-bf3e-48af-9139-87d7165ed509]
description = "16 is XVI"

[2bda64ca-7d28-4c56-b08d-16ce65716cf6]
description = "27 is XXVII"

Expand All @@ -42,6 +45,9 @@ description = "49 is XLIX"
[d5b283d4-455d-4e68-aacf-add6c4b51915]
description = "59 is LIX"

[4465ffd5-34dc-44f3-ada5-56f5007b6dad]
description = "66 is LXVI"

[46b46e5b-24da-4180-bfe2-2ef30b39d0d0]
description = "93 is XCIII"

Expand All @@ -51,17 +57,32 @@ description = "141 is CXLI"
[267f0207-3c55-459a-b81d-67cec7a46ed9]
description = "163 is CLXIII"

[902ad132-0b4d-40e3-8597-ba5ed611dd8d]
description = "166 is CLXVI"

[cdb06885-4485-4d71-8bfb-c9d0f496b404]
description = "402 is CDII"

[6b71841d-13b2-46b4-ba97-dec28133ea80]
description = "575 is DLXXV"

[dacb84b9-ea1c-4a61-acbb-ce6b36674906]
description = "666 is DCLXVI"

[432de891-7fd6-4748-a7f6-156082eeca2f]
description = "911 is CMXI"

[e6de6d24-f668-41c0-88d7-889c0254d173]
description = "1024 is MXXIV"

[efbe1d6a-9f98-4eb5-82bc-72753e3ac328]
description = "1666 is MDCLXVI"

[bb550038-d4eb-4be2-a9ce-f21961ac3bc6]
description = "3000 is MMM"

[3bc4b41c-c2e6-49d9-9142-420691504336]
description = "3001 is MMMI"

[4e18e96b-5fbb-43df-a91b-9cb511fe0856]
description = "3999 is MMMCMXCIX"
60 changes: 42 additions & 18 deletions exercises/practice/roman-numerals/roman_numerals.vader
Original file line number Diff line number Diff line change
@@ -1,53 +1,77 @@
Execute (1 is a single I):
Execute (1 is I):
AssertEqual 'I', ToRoman(1)

Execute (2 is two I's):
Execute (2 is II):
AssertEqual 'II', ToRoman(2)

Execute (2 is three I's):
Execute (3 is III):
AssertEqual 'III', ToRoman(3)

Execute (4, being 5 - 1, is IV):
Execute (4 is IV):
AssertEqual 'IV', ToRoman(4)

Execute (5 is a single V):
Execute (5 is V):
AssertEqual 'V', ToRoman(5)

Execute (6, being 5 + 1, is VI):
Execute (6 is VI):
AssertEqual 'VI', ToRoman(6)

Execute (9, being 10 - 1, is IX):
Execute (9 is IX):
AssertEqual 'IX', ToRoman(9)

Execute (20 is two X's):
Execute (16 is XVI):
AssertEqual 'XVI', ToRoman(16)

Execute (27 is XXVII):
AssertEqual 'XXVII', ToRoman(27)

Execute (48 is not 50 - 2, but rather 40 + 8):
Execute (48 is XLVIII):
AssertEqual 'XLVIII', ToRoman(48)

Execute (50 is a single L):
Execute (49 is XLIX):
AssertEqual 'XLIX', ToRoman(49)

Execute (59 is LIX):
AssertEqual 'LIX', ToRoman(59)

Execute (90, being 100 - 10, is XC):
Execute (66 is LXVI):
AssertEqual 'LXVI', ToRoman(66)

Execute (93 is XCIII):
AssertEqual 'XCIII', ToRoman(93)

Execute (100 is a single C):
Execute (141 is CXLI):
AssertEqual 'CXLI', ToRoman(141)

Execute (60, being 50 + 10, is LX):
Execute (163 is CLXIII):
AssertEqual 'CLXIII', ToRoman(163)

Execute (400, being 500 - 100, is CD):
Execute (166 is CLXVI):
AssertEqual 'CLXVI', ToRoman(166)

Execute (402 is CDII):
AssertEqual 'CDII', ToRoman(402)

Execute (500 is a single D):
Execute (575 is DLXXV):
AssertEqual 'DLXXV', ToRoman(575)

Execute (900, being 1000 - 100, is CM):
Execute (666 is DCLXVI):
AssertEqual 'DCLXVI', ToRoman(666)

Execute (911 is CMXI):
AssertEqual 'CMXI', ToRoman(911)

Execute (1000 is a single M):
Execute (1024 is MXXIV):
AssertEqual 'MXXIV', ToRoman(1024)

Execute (3000 is three M's):
Execute (1666 is MDCLXVI):
AssertEqual 'MDCLXVI', ToRoman(1666)

Execute (3000 is MMM):
AssertEqual 'MMM', ToRoman(3000)

Execute (3001 is MMMI):
AssertEqual 'MMMI', ToRoman(3001)

Execute (3999 is MMMCMXCIX):
AssertEqual 'MMMCMXCIX', ToRoman(3999)
8 changes: 7 additions & 1 deletion exercises/practice/triangle/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ description = "scalene triangle -> no sides are equal"
description = "scalene triangle -> all sides are equal"

[c6e15a92-90d9-4fb3-90a2-eef64f8d3e1e]
description = "scalene triangle -> two sides are equal"
description = "scalene triangle -> first and second sides are equal"

[3da23a91-a166-419a-9abf-baf4868fd985]
description = "scalene triangle -> first and third sides are equal"

[b6a75d98-1fef-4c42-8e9a-9db854ba0a4d]
description = "scalene triangle -> second and third sides are equal"

[70ad5154-0033-48b7-af2c-b8d739cd9fdc]
description = "scalene triangle -> may not violate triangle inequality"
Expand Down
Loading