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",
"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": [
]
}

View file

@ -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": {

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 func input = List.map func input
-- case input of
-- [] -> []
-- otherwise ->
accumulate func input =
List.map func input

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
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)

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 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,
-- 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)

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 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 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)

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

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 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)

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
| 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 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)

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

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 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)

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 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 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)

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 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 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)

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"
}