mirror of
https://github.com/correl/elm.git
synced 2024-11-15 19:19:31 +00:00
Align cherry picked exercises with the new test format
This commit is contained in:
parent
5bbeef5242
commit
5b8970a2db
34 changed files with 247 additions and 106 deletions
14
config.json
14
config.json
|
@ -10,17 +10,24 @@
|
|||
"leap",
|
||||
"raindrops",
|
||||
"pangram",
|
||||
"accumulate",
|
||||
"triangle",
|
||||
"anagram",
|
||||
"space-age",
|
||||
"strain",
|
||||
"difference-of-squares",
|
||||
"word-count",
|
||||
"sum-of-multiples",
|
||||
"hamming",
|
||||
"rna-transcription",
|
||||
"run-length-encoding"
|
||||
"run-length-encoding",
|
||||
"sublist",
|
||||
"nucleotide-count",
|
||||
"phone-number",
|
||||
"grade-school"
|
||||
],
|
||||
"deprecated": [
|
||||
"Leap",
|
||||
"Accumulate"
|
||||
|
||||
],
|
||||
"ignored": [
|
||||
"bin",
|
||||
|
@ -29,6 +36,5 @@
|
|||
"docs"
|
||||
],
|
||||
"foregone": [
|
||||
|
||||
]
|
||||
}
|
||||
|
|
|
@ -17,18 +17,14 @@
|
|||
"./exercises/anagram",
|
||||
"./exercises/raindrops",
|
||||
"./exercises/triangle",
|
||||
"Leap",
|
||||
"Accumulate",
|
||||
"RNATranscription",
|
||||
"Sublist",
|
||||
"Bob",
|
||||
"SumOfMultiples",
|
||||
"Strain",
|
||||
"SpaceAge",
|
||||
"Anagram",
|
||||
"NucleotideCount",
|
||||
"PhoneNumber",
|
||||
"GradeSchool"
|
||||
"./exercises/accumulate",
|
||||
"./exercises/sublist",
|
||||
"./exercises/sum-of-multiples",
|
||||
"./exercises/strain",
|
||||
"./exercises/space-age",
|
||||
"./exercises/nucleotide-count",
|
||||
"./exercises/phone-number",
|
||||
"./exercises/grade-school"
|
||||
],
|
||||
"exposed-modules": [],
|
||||
"dependencies": {
|
||||
|
|
1
exercises/accumulate/Accumulate.elm
Normal file
1
exercises/accumulate/Accumulate.elm
Normal file
|
@ -0,0 +1 @@
|
|||
module Accumulate (..) where
|
|
@ -1,7 +1,6 @@
|
|||
module AccumulateExample where
|
||||
module Accumulate (..) where
|
||||
|
||||
|
||||
accumulate : (a -> b) -> List a -> List b
|
||||
accumulate func input = List.map func input
|
||||
-- case input of
|
||||
-- [] -> []
|
||||
-- otherwise ->
|
||||
accumulate func input =
|
||||
List.map func input
|
||||
|
|
|
@ -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
|
||||
|
||||
square : Int -> Int
|
||||
|
@ -19,4 +18,6 @@ tests = suite "Accumulate"
|
|||
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)
|
||||
|
|
16
exercises/accumulate/elm-package.json
Normal file
16
exercises/accumulate/elm-package.json
Normal 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"
|
||||
}
|
2
exercises/grade-school/GradeSchool.elm
Normal file
2
exercises/grade-school/GradeSchool.elm
Normal file
|
@ -0,0 +1,2 @@
|
|||
module GradeSchool (..) where
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
module GradeSchoolExample where
|
||||
module GradeSchool (..) where
|
||||
|
||||
import Dict exposing (..)
|
||||
import Result exposing (toMaybe)
|
||||
|
|
|
@ -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,
|
||||
-- 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 GradeSchool as S exposing (..)
|
||||
|
||||
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))
|
||||
]
|
||||
|
||||
main = runDisplay tests
|
||||
|
||||
port runner : Signal (Task.Task x ())
|
||||
port runner =
|
||||
Console.run (consoleRunner tests)
|
||||
|
|
16
exercises/grade-school/elm-package.json
Normal file
16
exercises/grade-school/elm-package.json
Normal 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"
|
||||
}
|
1
exercises/nucleotide-count/NucleotideCount.elm
Normal file
1
exercises/nucleotide-count/NucleotideCount.elm
Normal file
|
@ -0,0 +1 @@
|
|||
module NucleotideCount (..) where
|
|
@ -1,4 +1,4 @@
|
|||
module NucleotideCountExample where
|
||||
module NucleotideCount (..) where
|
||||
|
||||
import String
|
||||
import List
|
||||
|
|
|
@ -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 ElmTest.Test exposing (test, Test, suite)
|
||||
import ElmTest.Assertion exposing (assert, assertEqual)
|
||||
import ElmTest.Runner.Element exposing (runDisplay)
|
||||
import NucleotideCount exposing (nucleotideCounts)
|
||||
|
||||
tests : Test
|
||||
tests = suite "NucleotideCount test suite"
|
||||
|
@ -19,4 +17,6 @@ tests = suite "NucleotideCount test suite"
|
|||
(nucleotideCounts "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"))
|
||||
]
|
||||
|
||||
main = runDisplay tests
|
||||
port runner : Signal (Task.Task x ())
|
||||
port runner =
|
||||
Console.run (consoleRunner tests)
|
||||
|
|
16
exercises/nucleotide-count/elm-package.json
Normal file
16
exercises/nucleotide-count/elm-package.json
Normal 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"
|
||||
}
|
1
exercises/phone-number/PhoneNumber.elm
Normal file
1
exercises/phone-number/PhoneNumber.elm
Normal file
|
@ -0,0 +1 @@
|
|||
module PhoneNumber (..) where
|
|
@ -1,4 +1,4 @@
|
|||
module PhoneNumberExample where
|
||||
module PhoneNumber (..) where
|
||||
|
||||
import String
|
||||
|
|
@ -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 ElmTest.Test exposing (test, Test, suite)
|
||||
import ElmTest.Assertion exposing (assert, assertEqual)
|
||||
import ElmTest.Runner.Element exposing (runDisplay)
|
||||
import PhoneNumber exposing (getNumber, printPretty)
|
||||
|
||||
tests : Test
|
||||
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"))
|
||||
]
|
||||
|
||||
main = runDisplay tests
|
||||
port runner : Signal (Task.Task x ())
|
||||
port runner =
|
||||
Console.run (consoleRunner tests)
|
||||
|
||||
|
|
16
exercises/phone-number/elm-package.json
Normal file
16
exercises/phone-number/elm-package.json
Normal 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"
|
||||
}
|
1
exercises/space-age/SpaceAge.elm
Normal file
1
exercises/space-age/SpaceAge.elm
Normal file
|
@ -0,0 +1 @@
|
|||
module SpaceAge (..) where
|
|
@ -1,4 +1,4 @@
|
|||
module SpaceAgeExample where
|
||||
module SpaceAge (..) where
|
||||
|
||||
type Planet = Mercury
|
||||
| Venus
|
||||
|
|
|
@ -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 ElmTest.Assertion exposing (assert, assertEqual)
|
||||
import ElmTest.Runner.Element exposing (runDisplay)
|
||||
|
||||
import SpaceAgeExample exposing (Planet(..), ageOn)
|
||||
import SpaceAge exposing (Planet(..), ageOn)
|
||||
|
||||
tests : Test
|
||||
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)
|
||||
|
||||
|
|
16
exercises/space-age/elm-package.json
Normal file
16
exercises/space-age/elm-package.json
Normal 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"
|
||||
}
|
1
exercises/strain/Strain.elm
Normal file
1
exercises/strain/Strain.elm
Normal file
|
@ -0,0 +1 @@
|
|||
module Strain (..) where
|
|
@ -1,4 +1,4 @@
|
|||
module StrainExample where
|
||||
module Strain (..) where
|
||||
|
||||
import List
|
||||
|
||||
|
|
|
@ -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 ElmTest.Assertion exposing (assert, assertEqual)
|
||||
import ElmTest.Runner.Element exposing (runDisplay)
|
||||
|
||||
import StrainExample exposing (keep, discard)
|
||||
import Strain exposing (keep, discard)
|
||||
|
||||
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"]))
|
||||
]
|
||||
|
||||
main = runDisplay tests
|
||||
port runner : Signal (Task.Task x ())
|
||||
port runner =
|
||||
Console.run (consoleRunner tests)
|
||||
|
||||
|
|
16
exercises/strain/elm-package.json
Normal file
16
exercises/strain/elm-package.json
Normal 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"
|
||||
}
|
1
exercises/sublist/Sublist.elm
Normal file
1
exercises/sublist/Sublist.elm
Normal file
|
@ -0,0 +1 @@
|
|||
module Sublist (..) where
|
|
@ -1,4 +1,4 @@
|
|||
module SublistExample where
|
||||
module Sublist (..) where
|
||||
import List exposing (..)
|
||||
import String
|
||||
|
||||
|
|
|
@ -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 ElmTest.Assertion exposing (assert, assertEqual)
|
||||
import ElmTest.Runner.Element exposing (runDisplay)
|
||||
|
||||
import SublistExample exposing (sublist)
|
||||
import Sublist exposing (sublist)
|
||||
|
||||
tests : Test
|
||||
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]))
|
||||
]
|
||||
|
||||
main = runDisplay tests
|
||||
port runner : Signal (Task.Task x ())
|
||||
port runner =
|
||||
Console.run (consoleRunner tests)
|
||||
|
||||
|
|
16
exercises/sublist/elm-package.json
Normal file
16
exercises/sublist/elm-package.json
Normal 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"
|
||||
}
|
1
exercises/sum-of-multiples/SumOfMultiples.elm
Normal file
1
exercises/sum-of-multiples/SumOfMultiples.elm
Normal file
|
@ -0,0 +1 @@
|
|||
module SumOfMultiples (..) where
|
|
@ -1,4 +1,4 @@
|
|||
module SumOfMultiplesExample where
|
||||
module SumOfMultiples (..) where
|
||||
|
||||
sumOfMultiples : List Int -> Int -> Int
|
||||
sumOfMultiples factors upperLimit =
|
||||
|
|
|
@ -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 ElmTest.Assertion exposing (assert, assertEqual)
|
||||
import ElmTest.Runner.Element exposing (runDisplay)
|
||||
|
||||
import SumOfMultiplesExample exposing (sumOfMultiples)
|
||||
import SumOfMultiples exposing (sumOfMultiples)
|
||||
|
||||
tests : Test
|
||||
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)
|
||||
|
||||
|
|
16
exercises/sum-of-multiples/elm-package.json
Normal file
16
exercises/sum-of-multiples/elm-package.json
Normal 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"
|
||||
}
|
Loading…
Reference in a new issue