Align cherry picked exercises with the new test format

This commit is contained in:
Erik Simmler 2016-03-16 21:38:35 -04:00
parent 5bbeef5242
commit 5b8970a2db
34 changed files with 247 additions and 106 deletions

View file

@ -10,17 +10,24 @@
"leap", "leap",
"raindrops", "raindrops",
"pangram", "pangram",
"accumulate",
"triangle", "triangle",
"anagram", "anagram",
"space-age",
"strain",
"difference-of-squares", "difference-of-squares",
"word-count", "word-count",
"sum-of-multiples",
"hamming", "hamming",
"rna-transcription", "rna-transcription",
"run-length-encoding" "run-length-encoding",
"sublist",
"nucleotide-count",
"phone-number",
"grade-school"
], ],
"deprecated": [ "deprecated": [
"Leap",
"Accumulate"
], ],
"ignored": [ "ignored": [
"bin", "bin",
@ -29,6 +36,5 @@
"docs" "docs"
], ],
"foregone": [ "foregone": [
] ]
} }

View file

@ -17,18 +17,14 @@
"./exercises/anagram", "./exercises/anagram",
"./exercises/raindrops", "./exercises/raindrops",
"./exercises/triangle", "./exercises/triangle",
"Leap", "./exercises/accumulate",
"Accumulate", "./exercises/sublist",
"RNATranscription", "./exercises/sum-of-multiples",
"Sublist", "./exercises/strain",
"Bob", "./exercises/space-age",
"SumOfMultiples", "./exercises/nucleotide-count",
"Strain", "./exercises/phone-number",
"SpaceAge", "./exercises/grade-school"
"Anagram",
"NucleotideCount",
"PhoneNumber",
"GradeSchool"
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {

View file

@ -0,0 +1 @@
module Accumulate (..) where

View file

@ -1,7 +1,6 @@
module AccumulateExample where module Accumulate (..) where
accumulate : (a -> b) -> List a -> List b accumulate : (a -> b) -> List a -> List b
accumulate func input = List.map func input accumulate func input =
-- case input of List.map func input
-- [] -> []
-- otherwise ->

View file

@ -1,11 +1,10 @@
module AccumulateTest where module Main (..) where
-- TODO - remove example inclusion once Problem sets are ready to go live or CI is set up. import Task
import Console
import ElmTest exposing (..)
import Accumulate exposing (accumulate)
import AccumulateExample exposing (accumulate)
import ElmTest.Test exposing (test, Test, suite)
import ElmTest.Assertion exposing (assert, assertEqual)
import ElmTest.Runner.Element exposing (runDisplay)
import String import String
square : Int -> Int square : Int -> Int
@ -19,4 +18,6 @@ tests = suite "Accumulate"
test "reverse Accumulate" (assertEqual ["olleh","dlrow"] (accumulate String.reverse ["hello" , "world"])) test "reverse Accumulate" (assertEqual ["olleh","dlrow"] (accumulate String.reverse ["hello" , "world"]))
] ]
main = runDisplay tests port runner : Signal (Task.Task x ())
port runner =
Console.run (consoleRunner tests)

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0",
"summary": "Exercism problems in Elm.",
"repository": "https://github.com/exercism/xelm.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"deadfoxygrandpa/elm-test": "3.0.1 <= v < 4.0.0",
"elm-lang/core": "2.0.0 <= v < 4.0.0",
"laszlopandy/elm-console": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.15.0 <= v < 0.17.0"
}

View file

@ -0,0 +1,2 @@
module GradeSchool (..) where

View file

@ -1,4 +1,4 @@
module GradeSchoolExample where module GradeSchool (..) where
import Dict exposing (..) import Dict exposing (..)
import Result exposing (toMaybe) import Result exposing (toMaybe)

View file

@ -1,16 +1,10 @@
module GradeSchoolTest where module Main (..) where
-- TODO - remove example inclusion once Problem sets are ready to go live or CI is set up. import Task
import Console
import ElmTest exposing (..)
-- import GradeSchoolExample exposing (addStudent, import GradeSchool as S exposing (..)
-- newSchool, gradeWithStudents, schoolFromList,
-- studentsInGrade, schoolToList)
import GradeSchoolExample as S exposing (..)
import ElmTest.Test exposing (test, Test, suite)
import ElmTest.Assertion exposing (assert, assertEqual)
import ElmTest.Runner.Element exposing (runDisplay)
import Dict import Dict
@ -28,4 +22,7 @@ tests = suite "GradeSchool Test Suite"
test "get students in a non-existent grade" (assertEqual [] (S.studentsInGrade 1 S.newSchool)) test "get students in a non-existent grade" (assertEqual [] (S.studentsInGrade 1 S.newSchool))
] ]
main = runDisplay tests
port runner : Signal (Task.Task x ())
port runner =
Console.run (consoleRunner tests)

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0",
"summary": "Exercism problems in Elm.",
"repository": "https://github.com/exercism/xelm.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"deadfoxygrandpa/elm-test": "3.0.1 <= v < 4.0.0",
"elm-lang/core": "2.0.0 <= v < 4.0.0",
"laszlopandy/elm-console": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.15.0 <= v < 0.17.0"
}

View file

@ -0,0 +1 @@
module NucleotideCount (..) where

View file

@ -1,4 +1,4 @@
module NucleotideCountExample where module NucleotideCount (..) where
import String import String
import List import List

View file

@ -1,12 +1,10 @@
module NucleotideCountTest where module Main (..) where
-- TODO - remove example inclusion once Problem sets are ready to go live or CI is set up. import Task
import Console
import ElmTest exposing (..)
import NucleotideCountExample exposing (nucleotideCounts) import NucleotideCount exposing (nucleotideCounts)
import ElmTest.Test exposing (test, Test, suite)
import ElmTest.Assertion exposing (assert, assertEqual)
import ElmTest.Runner.Element exposing (runDisplay)
tests : Test tests : Test
tests = suite "NucleotideCount test suite" tests = suite "NucleotideCount test suite"
@ -19,4 +17,6 @@ tests = suite "NucleotideCount test suite"
(nucleotideCounts "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC")) (nucleotideCounts "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"))
] ]
main = runDisplay tests port runner : Signal (Task.Task x ())
port runner =
Console.run (consoleRunner tests)

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0",
"summary": "Exercism problems in Elm.",
"repository": "https://github.com/exercism/xelm.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"deadfoxygrandpa/elm-test": "3.0.1 <= v < 4.0.0",
"elm-lang/core": "2.0.0 <= v < 4.0.0",
"laszlopandy/elm-console": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.15.0 <= v < 0.17.0"
}

View file

@ -0,0 +1 @@
module PhoneNumber (..) where

View file

@ -1,4 +1,4 @@
module PhoneNumberExample where module PhoneNumber (..) where
import String import String

View file

@ -1,12 +1,10 @@
module PhoneNumberTest where module Main (..) where
-- TODO - remove example inclusion once Problem sets are ready to go live or CI is set up. import Task
import Console
import ElmTest exposing (..)
import PhoneNumberExample exposing (getNumber, printPretty) import PhoneNumber exposing (getNumber, printPretty)
import ElmTest.Test exposing (test, Test, suite)
import ElmTest.Assertion exposing (assert, assertEqual)
import ElmTest.Runner.Element exposing (runDisplay)
tests : Test tests : Test
tests = suite "PhoneNumber test suite" tests = suite "PhoneNumber test suite"
@ -25,4 +23,7 @@ tests = suite "PhoneNumber test suite"
test "pretty print with full us phone number" (assertEqual "(123) 456-7890" (printPretty "11234567890")) test "pretty print with full us phone number" (assertEqual "(123) 456-7890" (printPretty "11234567890"))
] ]
main = runDisplay tests port runner : Signal (Task.Task x ())
port runner =
Console.run (consoleRunner tests)

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0",
"summary": "Exercism problems in Elm.",
"repository": "https://github.com/exercism/xelm.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"deadfoxygrandpa/elm-test": "3.0.1 <= v < 4.0.0",
"elm-lang/core": "2.0.0 <= v < 4.0.0",
"laszlopandy/elm-console": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.15.0 <= v < 0.17.0"
}

View file

@ -0,0 +1 @@
module SpaceAge (..) where

View file

@ -1,4 +1,4 @@
module SpaceAgeExample where module SpaceAge (..) where
type Planet = Mercury type Planet = Mercury
| Venus | Venus

View file

@ -1,12 +1,10 @@
module SpaceAgeTest where module Main (..) where
-- TODO - remove example inclusion once Problem sets are ready to go live or CI is set up. import Task
import Console
import ElmTest exposing (..)
import ElmTest.Test exposing (test, Test, suite) import SpaceAge exposing (Planet(..), ageOn)
import ElmTest.Assertion exposing (assert, assertEqual)
import ElmTest.Runner.Element exposing (runDisplay)
import SpaceAgeExample exposing (Planet(..), ageOn)
tests : Test tests : Test
tests = suite "SpaceAge Test Suite" tests = suite "SpaceAge Test Suite"
@ -22,4 +20,7 @@ tests = suite "SpaceAge Test Suite"
] ]
main = runDisplay tests port runner : Signal (Task.Task x ())
port runner =
Console.run (consoleRunner tests)

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0",
"summary": "Exercism problems in Elm.",
"repository": "https://github.com/exercism/xelm.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"deadfoxygrandpa/elm-test": "3.0.1 <= v < 4.0.0",
"elm-lang/core": "2.0.0 <= v < 4.0.0",
"laszlopandy/elm-console": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.15.0 <= v < 0.17.0"
}

View file

@ -0,0 +1 @@
module Strain (..) where

View file

@ -1,4 +1,4 @@
module StrainExample where module Strain (..) where
import List import List

View file

@ -1,12 +1,10 @@
module StrainTest where module Main (..) where
-- TODO - remove example inclusion once Problem sets are ready to go live or CI is set up. import Task
import Console
import ElmTest exposing (..)
import ElmTest.Test exposing (test, Test, suite) import Strain exposing (keep, discard)
import ElmTest.Assertion exposing (assert, assertEqual)
import ElmTest.Runner.Element exposing (runDisplay)
import StrainExample exposing (keep, discard)
import String import String
@ -31,4 +29,7 @@ tests = suite "Strain Test Suite"
test "discard strings" (assertEqual ["apple", "banana", "cherimoya"] (discard (isFirstLetter "z") ["apple", "zebra", "banana", "zombies", "cherimoya", "zealot"])) test "discard strings" (assertEqual ["apple", "banana", "cherimoya"] (discard (isFirstLetter "z") ["apple", "zebra", "banana", "zombies", "cherimoya", "zealot"]))
] ]
main = runDisplay tests port runner : Signal (Task.Task x ())
port runner =
Console.run (consoleRunner tests)

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0",
"summary": "Exercism problems in Elm.",
"repository": "https://github.com/exercism/xelm.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"deadfoxygrandpa/elm-test": "3.0.1 <= v < 4.0.0",
"elm-lang/core": "2.0.0 <= v < 4.0.0",
"laszlopandy/elm-console": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.15.0 <= v < 0.17.0"
}

View file

@ -0,0 +1 @@
module Sublist (..) where

View file

@ -1,4 +1,4 @@
module SublistExample where module Sublist (..) where
import List exposing (..) import List exposing (..)
import String import String

View file

@ -1,12 +1,10 @@
module SublistTest where module Main (..) where
-- TODO - remove example inclusion once Problem sets are ready to go live or CI is set up. import Task
import Console
import ElmTest exposing (..)
import ElmTest.Test exposing (test, Test, suite) import Sublist exposing (sublist)
import ElmTest.Assertion exposing (assert, assertEqual)
import ElmTest.Runner.Element exposing (runDisplay)
import SublistExample exposing (sublist)
tests : Test tests : Test
tests = suite "Sublist Test Suite" tests = suite "Sublist Test Suite"
@ -30,4 +28,7 @@ tests = suite "Sublist Test Suite"
test "recurring values unequal" (assertEqual "Unequal" (sublist [1,2,1,2,3] [1,2,3,1,2,3,2,3,2,1])) test "recurring values unequal" (assertEqual "Unequal" (sublist [1,2,1,2,3] [1,2,3,1,2,3,2,3,2,1]))
] ]
main = runDisplay tests port runner : Signal (Task.Task x ())
port runner =
Console.run (consoleRunner tests)

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0",
"summary": "Exercism problems in Elm.",
"repository": "https://github.com/exercism/xelm.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"deadfoxygrandpa/elm-test": "3.0.1 <= v < 4.0.0",
"elm-lang/core": "2.0.0 <= v < 4.0.0",
"laszlopandy/elm-console": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.15.0 <= v < 0.17.0"
}

View file

@ -0,0 +1 @@
module SumOfMultiples (..) where

View file

@ -1,4 +1,4 @@
module SumOfMultiplesExample where module SumOfMultiples (..) where
sumOfMultiples : List Int -> Int -> Int sumOfMultiples : List Int -> Int -> Int
sumOfMultiples factors upperLimit = sumOfMultiples factors upperLimit =

View file

@ -1,12 +1,10 @@
module SumOfMultiplesTest where module Main (..) where
-- TODO - remove example inclusion once Problem sets are ready to go live or CI is set up. import Task
import Console
import ElmTest exposing (..)
import ElmTest.Test exposing (test, Test, suite) import SumOfMultiples exposing (sumOfMultiples)
import ElmTest.Assertion exposing (assert, assertEqual)
import ElmTest.Runner.Element exposing (runDisplay)
import SumOfMultiplesExample exposing (sumOfMultiples)
tests : Test tests : Test
tests = suite "Sum Of Multiples Test Suite" tests = suite "Sum Of Multiples Test Suite"
@ -19,4 +17,7 @@ tests = suite "Sum Of Multiples Test Suite"
] ]
main = runDisplay tests port runner : Signal (Task.Task x ())
port runner =
Console.run (consoleRunner tests)

View file

@ -0,0 +1,16 @@
{
"version": "1.0.0",
"summary": "Exercism problems in Elm.",
"repository": "https://github.com/exercism/xelm.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"deadfoxygrandpa/elm-test": "3.0.1 <= v < 4.0.0",
"elm-lang/core": "2.0.0 <= v < 4.0.0",
"laszlopandy/elm-console": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.15.0 <= v < 0.17.0"
}