From 702bfe7392a885b767fc1afc1a2e8b1960cae654 Mon Sep 17 00:00:00 2001 From: SimaDovakin Date: Sat, 4 Jan 2025 15:19:29 +0200 Subject: [PATCH 1/2] Upgraded tests for acronym and all-your-base exercises using not deprecated functionality. --- .../acronym/.meta/testAnnotation.json | 38 +-- exercises/practice/acronym/acronym.test.u | 83 ++++-- .../all-your-base/.meta/testAnnotation.json | 42 +-- .../practice/all-your-base/allYourBase.test.u | 278 ++++++++++++------ 4 files changed, 296 insertions(+), 145 deletions(-) diff --git a/exercises/practice/acronym/.meta/testAnnotation.json b/exercises/practice/acronym/.meta/testAnnotation.json index bc8e952..a7ed7b2 100644 --- a/exercises/practice/acronym/.meta/testAnnotation.json +++ b/exercises/practice/acronym/.meta/testAnnotation.json @@ -1,38 +1,38 @@ [ { - "name": "acronym.test.basic", - "test_code": "Test.expect (abbreviate \"Portable Network Graphics\" === \"PNG\")" + "name": "basic", + "test_code": "verify do\n labeled \"basic\" do\n expected = \"PNG\"\n actual = abbreviate \"Portable Network Graphics\"\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual actual expected" }, { - "name": "acronym.test.lowercaseWords", - "test_code": "Test.expect (abbreviate \"Ruby on Rails\" === \"ROR\")" + "name": "lowercase words", + "test_code": "verify do\n labeled \"lowercase words\" do\n expected = \"ROR\"\n actual = abbreviate \"Ruby on Rails\"\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual actual expected" }, { - "name": "acronym.test.punctuation", - "test_code": "Test.expect (abbreviate \"First In, First Out\" === \"FIFO\")" + "name": "punctuation", + "test_code": "verify do\n labeled \"punctuation\" do\n expected = \"FIFO\"\n actual = abbreviate \"First In, First Out\"\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual actual expected" }, { - "name": "acronym.test.allCapsWord", - "test_code": "Test.expect (abbreviate \"GNU Image Manipulation Program\" === \"GIMP\")" + "name": "all caps word", + "test_code": "verify do\n labeled \"all caps word\" do\n expected = \"GIMP\"\n actual = abbreviate \"GNU Image Manipulation Program\"\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual actual expected" }, { - "name": "acronym.test.punctuationWithoutWhitespace", - "test_code": "Test.expect (abbreviate \"Complementary metal-oxide semiconductor\" === \"CMOS\")" + "name": "punctuation without whitespace", + "test_code": "verify do\n labeled \"punctuation without whitespace\" do\n expected = \"CMOS\"\n actual = abbreviate \"Complementary metal-oxide semiconductor\"\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual actual expected" }, { - "name": "acronym.test.veryLongAbbreviation", - "test_code": "Test.expect (abbreviate \"Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me\" === \"ROTFLSHTMDCOALM\")" + "name": "very long abbreviation", + "test_code": "verify do\n labeled \"very long abbreviation\" do\n expected = \"ROTFLSHTMDCOALM\"\n actual = abbreviate \"Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me\"\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual actual expected" }, { - "name": "acronym.test.consecutiveDelimiters", - "test_code": "Test.expect (abbreviate \"Something - I made up from thin air\" === \"SIMUFTA\")" + "name": "consecutive delimiters", + "test_code": "verify do\n labeled \"consecutive delimiters\" do\n expected = \"SIMUFTA\"\n actual = abbreviate \"Something - I made up from thin air\"\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual actual expected" }, { - "name": "acronym.test.apostrophes", - "test_code": "Test.expect (abbreviate \"Halley's Comet\" === \"HC\")" + "name": "apostrophes", + "test_code": "verify do\n labeled \"apostrophes\" do\n expected = \"HC\"\n actual = abbreviate \"Halley's Comet\"\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual actual expected" }, { - "name": "acronym.test.underscoreEmphasis", - "test_code": "Test.expect (abbreviate \"The Road _Not_ Taken\" === \"TRNT\")" + "name": "underscore emphasis", + "test_code": "verify do\n labeled \"underscore emphasis\" do\n expected = \"TRNT\"\n actual = abbreviate \"The Road _Not_ Taken\"\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual actual expected" } -] \ No newline at end of file +] diff --git a/exercises/practice/acronym/acronym.test.u b/exercises/practice/acronym/acronym.test.u index 6c98d89..f7c5ffb 100644 --- a/exercises/practice/acronym/acronym.test.u +++ b/exercises/practice/acronym/acronym.test.u @@ -1,34 +1,79 @@ use base.test.Test -acronym.test.basic = - Test.expect (abbreviate "Portable Network Graphics" === "PNG") +acronym.test.basic = verify do + labeled "basic" do + expected = "PNG" + actual = abbreviate "Portable Network Graphics" + label "expected" expected + label "actual" actual + ensureEqual actual expected -acronym.test.lowercaseWords = - Test.expect (abbreviate "Ruby on Rails" === "ROR") +acronym.test.lowercaseWords = verify do + labeled "lowercase words" do + expected = "ROR" + actual = abbreviate "Ruby on Rails" + label "expected" expected + label "actual" actual + ensureEqual actual expected -acronym.test.punctuation = - Test.expect (abbreviate "First In, First Out" === "FIFO") +acronym.test.punctuation = verify do + labeled "punctuation" do + expected = "FIFO" + actual = abbreviate "First In, First Out" + label "expected" expected + label "actual" actual + ensureEqual actual expected -acronym.test.allCapsWord = - Test.expect (abbreviate "GNU Image Manipulation Program" === "GIMP") +acronym.test.allCapsWord = verify do + labeled "all caps word" do + expected = "GIMP" + actual = abbreviate "GNU Image Manipulation Program" + label "expected" expected + label "actual" actual + ensureEqual actual expected -acronym.test.punctuationWithoutWhitespace = - Test.expect (abbreviate "Complementary metal-oxide semiconductor" === "CMOS") +acronym.test.punctuationWithoutWhitespace = verify do + labeled "punctuation without whitespace" do + expected = "CMOS" + actual = abbreviate "Complementary metal-oxide semiconductor" + label "expected" expected + label "actual" actual + ensureEqual actual expected -acronym.test.veryLongAbbreviation = - Test.expect (abbreviate "Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me" === "ROTFLSHTMDCOALM") +acronym.test.veryLongAbbreviation = verify do + labeled "very long abbreviation" do + expected = "ROTFLSHTMDCOALM" + actual = abbreviate "Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me" + label "expected" expected + label "actual" actual + ensureEqual actual expected -acronym.test.consecutiveDelimiters = - Test.expect (abbreviate "Something - I made up from thin air" === "SIMUFTA") +acronym.test.consecutiveDelimiters = verify do + labeled "consecutive delimiters" do + expected = "SIMUFTA" + actual = abbreviate "Something - I made up from thin air" + label "expected" expected + label "actual" actual + ensureEqual actual expected -acronym.test.apostrophes = - Test.expect (abbreviate "Halley's Comet" === "HC") +acronym.test.apostrophes = verify do + labeled "apostrophes" do + expected = "HC" + actual = abbreviate "Halley's Comet" + label "expected" expected + label "actual" actual + ensureEqual actual expected -acronym.test.underscoreEmphasis = - Test.expect (abbreviate "The Road _Not_ Taken" === "TRNT") +acronym.test.underscoreEmphasis = verify do + labeled "underscore emphasis" do + expected = "TRNT" + actual = abbreviate "The Road _Not_ Taken" + label "expected" expected + label "actual" actual + ensureEqual actual expected test> acronym.tests = - runAll [ + join [ acronym.test.basic, acronym.test.lowercaseWords, acronym.test.punctuation, diff --git a/exercises/practice/all-your-base/.meta/testAnnotation.json b/exercises/practice/all-your-base/.meta/testAnnotation.json index 3216a12..4954353 100644 --- a/exercises/practice/all-your-base/.meta/testAnnotation.json +++ b/exercises/practice/all-your-base/.meta/testAnnotation.json @@ -1,86 +1,86 @@ [ { "name": "single bit one to decimal", - "test_code": "let\n Test.label.deprecated \"single bit one to decimal\" <| Test.expect (rebase +2 [+1] +10 === Some [+1])" + "test_code": "verify do\n labeled \"single bit one to decimal\" do\n expected = Some [+1]\n actual = rebase +2 [+1] +10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "binary to single decimal", - "test_code": "let\n Test.label.deprecated \"binary to single decimal\" <| Test.expect (rebase +2 [+1,+0,+1] +10 === Some [+5])" + "test_code": "verify do\n labeled \"binary to single decimal\" do\n expected = Some [+5]\n actual = rebase +2 [+1,+0,+1] +10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "single decimal to binary", - "test_code": "let\n Test.label.deprecated \"single decimal to binary\" <| Test.expect (rebase +10 [+5] +2 === Some [+1,+0,+1])" + "test_code": "verify do\n labeled \"single decimal to binary\" do\n expected = Some [+1,+0,+1]\n actual = rebase +10 [+5] +2\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "binary to multiple decimal", - "test_code": "let\n Test.label.deprecated \"binary to multiple decimal\" <| Test.expect (rebase +2 [+1,+0,+1,+0,+1,+0] +10 === Some [+4,+2])" + "test_code": "verify do\n labeled \"binary to multiple decimal\" do\n expected = Some [+4,+2]\n actual = rebase +2 [+1,+0,+1,+0,+1,+0] +10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "decimal to binary", - "test_code": "let\n Test.label.deprecated \"decimal to binary\" <| Test.expect (rebase +10 [+4,+2] +2 === Some [+1,+0,+1,+0,+1,+0])" + "test_code": "verify do\n labeled \"decimal to binary\" do\n expected = Some [+1,+0,+1,+0,+1,+0]\n actual = rebase +10 [+4,+2] +2\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "trinary to hexadecimal", - "test_code": "let\n Test.label.deprecated \"trinary to hexadecimal\" <| Test.expect (rebase +3 [+1,+1,+2,+0] +16 === Some [+2,+10])" + "test_code": "verify do\n labeled \"trinary to hexadecimal\" do\n expected = Some [+2,+10]\n actual = rebase +3 [+1,+1,+2,+0] +16\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "hexadecimal to trinary", - "test_code": "let\n Test.label.deprecated \"hexadecimal to trinary\" <| Test.expect (rebase +16 [+2,+10] +3 === Some [+1,+1,+2,+0])" + "test_code": "verify do\n labeled \"hexadecimal to trinary\" do\n expected = Some [+1,+1,+2,+0]\n actual = rebase +16 [+2,+10] +3\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "15-bit integer", - "test_code": "let\n Test.label.deprecated \"15-bit integer\" <| Test.expect (rebase +97 [+3,+46,+60] +73 === Some [+6,+10,+45])" + "test_code": "verify do\n labeled \"15-bit integer\" do\n expected = Some [+6,+10,+45]\n actual = rebase +97 [+3,+46,+60] +73\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "empty list", - "test_code": "let\n Test.label.deprecated \"empty list\" <| Test.expect (rebase +2 [] +10 === Some [+0])" + "test_code": "verify do\n labeled \"empty list\" do\n expected = Some [+0]\n actual = rebase +2 [] +10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "single zero", - "test_code": "let\n Test.label.deprecated \"single zero\" <| Test.expect (rebase +10 [+0] +2 === Some [+0])" + "test_code": "verify do\n labeled \"single zero\" do\n expected = Some [+0]\n actual = rebase +10 [+0] +2\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "multiple zeros", - "test_code": "let\n Test.label.deprecated \"multiple zeros\" <| Test.expect (rebase +10 [+0,+0,+0] +2 === Some [+0])" + "test_code": "verify do\n labeled \"multiple zeros\" do\n expected = Some [+0]\n actual = rebase +10 [+0,+0,+0] +2\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "leading zeros", - "test_code": "let\n Test.label.deprecated \"leading zeros\" <| Test.expect (rebase +7 [+0,+6,+0] +10 === Some [+4,+2])" + "test_code": "verify do\n labeled \"leading zeros\" do\n expected = Some [+4,+2]\n actual = rebase +7 [+0,+6,+0] +10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "input base is one", - "test_code": "let\n Test.label.deprecated \"input base is one\" <| Test.expect (rebase +1 [+0] +10 === None)" + "test_code": "verify do\n labeled \"input base is one\" do\n expected = None\n actual = rebase +1 [+0] +10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "input base is zero", - "test_code": "let\n Test.label.deprecated \"input base is zero\" <| Test.expect (rebase +0 [] +10 === None)" + "test_code": "verify do\n labeled \"input base is zero\" do\n expected = None\n actual = rebase +0 [] +10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "input base is negative", - "test_code": "let\n Test.label.deprecated \"input base is negative\" <| Test.expect (rebase -2 [+1] +10 === None)" + "test_code": "verify do\n labeled \"input base is negative\" do\n expected = None\n actual = rebase -2 [+1] +10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "negative digit", - "test_code": "let\n Test.label.deprecated \"negative digit\" <| Test.expect (rebase +2 [+1,-1,+1,+0,+1,+0] +10 === None)" + "test_code": "verify do\n labeled \"negative digit\" do\n expected = None\n actual = rebase +2 [+1,-1,+1,+0,+1,+0] +10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "invalid positive digit", - "test_code": "let\n Test.label.deprecated \"invalid positive digit\" <| Test.expect (rebase +2 [+1,+2,+1,+0,+1,+0] +10 === None)" + "test_code": "verify do\n labeled \"invalid positive digit\" do\n expected = None\n actual = rebase +2 [+1,+2,+1,+0,+1,+0] +10\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "output base is one", - "test_code": "let\n Test.label.deprecated \"output base is one\" <| Test.expect (rebase +2 [+1,+0,+1,+0,+1,+0] +1 === None)" + "test_code": "verify do\n labeled \"output base is one\" do\n expected = None\n actual = rebase +2 [+1,+0,+1,+0,+1,+0] +1\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "output base is zero", - "test_code": "let\n Test.label.deprecated \"output base is zero\" <| Test.expect (rebase +10 [+7] +0 === None)" + "test_code": "verify do\n labeled \"output base is zero\" do\n expected = None\n actual = rebase +10 [+7] +0\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "output base is negative", - "test_code": "let\n Test.label.deprecated \"output base is negative\" <| Test.expect (rebase +2 [+1] -7 === None)" + "test_code": "verify do\n labeled \"output base is negative\" do\n expected = None\n actual = rebase +2 [+1] -7\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" }, { "name": "both bases are negative", - "test_code": "let\n Test.label.deprecated \"both bases are negative\" <| Test.expect (rebase -2 [+1] -7 === None)" + "test_code": "verify do\n labeled \"both bases are negative\" do\n expected = None\n actual = rebase -2 [+1] -7\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" } ] \ No newline at end of file diff --git a/exercises/practice/all-your-base/allYourBase.test.u b/exercises/practice/all-your-base/allYourBase.test.u index 4282554..960c967 100644 --- a/exercises/practice/all-your-base/allYourBase.test.u +++ b/exercises/practice/all-your-base/allYourBase.test.u @@ -1,86 +1,192 @@ -allYourBase.test.ex1 = let - Test.label.deprecated "single bit one to decimal" <| Test.expect (rebase +2 [+1] +10 === Some [+1]) - -allYourBase.test.ex2 = let - Test.label.deprecated "binary to single decimal" <| Test.expect (rebase +2 [+1,+0,+1] +10 === Some [+5]) - -allYourBase.test.ex3 = let - Test.label.deprecated "single decimal to binary" <| Test.expect (rebase +10 [+5] +2 === Some [+1,+0,+1]) - -allYourBase.test.ex4 = let - Test.label.deprecated "binary to multiple decimal" <| Test.expect (rebase +2 [+1,+0,+1,+0,+1,+0] +10 === Some [+4,+2]) - -allYourBase.test.ex5 = let - Test.label.deprecated "decimal to binary" <| Test.expect (rebase +10 [+4,+2] +2 === Some [+1,+0,+1,+0,+1,+0]) - -allYourBase.test.ex6 = let - Test.label.deprecated "trinary to hexadecimal" <| Test.expect (rebase +3 [+1,+1,+2,+0] +16 === Some [+2,+10]) - -allYourBase.test.ex7 = let - Test.label.deprecated "hexadecimal to trinary" <| Test.expect (rebase +16 [+2,+10] +3 === Some [+1,+1,+2,+0]) - -allYourBase.test.ex8 = let - Test.label.deprecated "15-bit integer" <| Test.expect (rebase +97 [+3,+46,+60] +73 === Some [+6,+10,+45]) - -allYourBase.test.ex9 = let - Test.label.deprecated "empty list" <| Test.expect (rebase +2 [] +10 === Some [+0]) - -allYourBase.test.ex10 = let - Test.label.deprecated "single zero" <| Test.expect (rebase +10 [+0] +2 === Some [+0]) - -allYourBase.test.ex11 = let - Test.label.deprecated "multiple zeros" <| Test.expect (rebase +10 [+0,+0,+0] +2 === Some [+0]) - -allYourBase.test.ex12 = let - Test.label.deprecated "leading zeros" <| Test.expect (rebase +7 [+0,+6,+0] +10 === Some [+4,+2]) - -allYourBase.test.ex13 = let - Test.label.deprecated "input base is one" <| Test.expect (rebase +1 [+0] +10 === None) - -allYourBase.test.ex14 = let - Test.label.deprecated "input base is zero" <| Test.expect (rebase +0 [] +10 === None) - -allYourBase.test.ex15 = let - Test.label.deprecated "input base is negative" <| Test.expect (rebase -2 [+1] +10 === None) - -allYourBase.test.ex16 = let - Test.label.deprecated "negative digit" <| Test.expect (rebase +2 [+1,-1,+1,+0,+1,+0] +10 === None) - -allYourBase.test.ex17 = let - Test.label.deprecated "invalid positive digit" <| Test.expect (rebase +2 [+1,+2,+1,+0,+1,+0] +10 === None) - -allYourBase.test.ex18 = let - Test.label.deprecated "output base is one" <| Test.expect (rebase +2 [+1,+0,+1,+0,+1,+0] +1 === None) - -allYourBase.test.ex19 = let - Test.label.deprecated "output base is zero" <| Test.expect (rebase +10 [+7] +0 === None) - -allYourBase.test.ex20 = let - Test.label.deprecated "output base is negative" <| Test.expect (rebase +2 [+1] -7 === None) - -allYourBase.test.ex21 = let - Test.label.deprecated "both bases are negative" <| Test.expect (rebase -2 [+1] -7 === None) - -test> allYourBase.tests = runAll [ - allYourBase.test.ex1, - allYourBase.test.ex2, - allYourBase.test.ex3, - allYourBase.test.ex4, - allYourBase.test.ex5, - allYourBase.test.ex6, - allYourBase.test.ex7, - allYourBase.test.ex8, - allYourBase.test.ex9, - allYourBase.test.ex10, - allYourBase.test.ex11, - allYourBase.test.ex12, - allYourBase.test.ex13, - allYourBase.test.ex14, - allYourBase.test.ex15, - allYourBase.test.ex16, - allYourBase.test.ex17, - allYourBase.test.ex18, - allYourBase.test.ex19, - allYourBase.test.ex20, - allYourBase.test.ex21 -] +allYourBase.test.ex1 = verify do + labeled "single bit one to decimal" do + expected = Some [+1] + actual = rebase +2 [+1] +10 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex2 = verify do + labeled "binary to single decimal" do + expected = Some [+5] + actual = rebase +2 [+1,+0,+1] +10 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex3 = verify do + labeled "single decimal to binary" do + expected = Some [+1,+0,+1] + actual = rebase +10 [+5] +2 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex4 = verify do + labeled "binary to multiple decimal" do + expected = Some [+4,+2] + actual = rebase +2 [+1,+0,+1,+0,+1,+0] +10 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex5 = verify do + labeled "decimal to binary" do + expected = Some [+1,+0,+1,+0,+1,+0] + actual = rebase +10 [+4,+2] +2 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex6 = verify do + labeled "trinary to hexadecimal" do + expected = Some [+2,+10] + actual = rebase +3 [+1,+1,+2,+0] +16 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex7 = verify do + labeled "hexadecimal to trinary" do + expected = Some [+1,+1,+2,+0] + actual = rebase +16 [+2,+10] +3 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex8 = verify do + labeled "15-bit integer" do + expected = Some [+6,+10,+45] + actual = rebase +97 [+3,+46,+60] +73 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex9 = verify do + labeled "empty list" do + expected = Some [+0] + actual = rebase +2 [] +10 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex10 = verify do + labeled "single zero" do + expected = Some [+0] + actual = rebase +10 [+0] +2 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex11 = verify do + labeled "multiple zeros" do + expected = Some [+0] + actual = rebase +10 [+0,+0,+0] +2 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex12 = verify do + labeled "leading zeros" do + expected = Some [+4,+2] + actual = rebase +7 [+0,+6,+0] +10 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex13 = verify do + labeled "input base is one" do + expected = None + actual = rebase +1 [+0] +10 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex14 = verify do + labeled "input base is zero" do + expected = None + actual = rebase +0 [] +10 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex15 = verify do + labeled "input base is negative" do + expected = None + actual = rebase -2 [+1] +10 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex16 = verify do + labeled "negative digit" do + expected = None + actual = rebase +2 [+1,-1,+1,+0,+1,+0] +10 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex17 = verify do + labeled "invalid positive digit" do + expected = None + actual = rebase +2 [+1,+2,+1,+0,+1,+0] +10 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex18 = verify do + labeled "output base is one" do + expected = None + actual = rebase +2 [+1,+0,+1,+0,+1,+0] +1 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex19 = verify do + labeled "output base is zero" do + expected = None + actual = rebase +10 [+7] +0 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex20 = verify do + labeled "output base is negative" do + expected = None + actual = rebase +2 [+1] -7 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +allYourBase.test.ex21 = verify do + labeled "both bases are negative" do + expected = None + actual = rebase -2 [+1] -7 + label "expected" expected + label "actual" actual + ensureEqual expected actual + +test> allYourBase.tests = + join [ + allYourBase.test.ex1, + allYourBase.test.ex2, + allYourBase.test.ex3, + allYourBase.test.ex4, + allYourBase.test.ex5, + allYourBase.test.ex6, + allYourBase.test.ex7, + allYourBase.test.ex8, + allYourBase.test.ex9, + allYourBase.test.ex10, + allYourBase.test.ex11, + allYourBase.test.ex12, + allYourBase.test.ex13, + allYourBase.test.ex14, + allYourBase.test.ex15, + allYourBase.test.ex16, + allYourBase.test.ex17, + allYourBase.test.ex18, + allYourBase.test.ex19, + allYourBase.test.ex20, + allYourBase.test.ex21 + ] From cca6c5403c1ed69b5f6aba8e2e820d07e603b034 Mon Sep 17 00:00:00 2001 From: SimaDovakin Date: Mon, 6 Jan 2025 12:29:05 +0200 Subject: [PATCH 2/2] Added new line in the end of testAnnotation.json --- exercises/practice/all-your-base/.meta/testAnnotation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/all-your-base/.meta/testAnnotation.json b/exercises/practice/all-your-base/.meta/testAnnotation.json index 4954353..51a602b 100644 --- a/exercises/practice/all-your-base/.meta/testAnnotation.json +++ b/exercises/practice/all-your-base/.meta/testAnnotation.json @@ -83,4 +83,4 @@ "name": "both bases are negative", "test_code": "verify do\n labeled \"both bases are negative\" do\n expected = None\n actual = rebase -2 [+1] -7\n label \"expected\" expected\n label \"actual\" actual\n ensureEqual expected actual" } -] \ No newline at end of file +]