elm/exercises/grade-school/GradeSchoolTests.elm

29 lines
1 KiB
Elm
Raw Normal View History

module Main (..) where
2015-10-14 19:02:13 +00:00
import Task
import Console
import ElmTest exposing (..)
2015-10-14 19:02:13 +00:00
import GradeSchool as S exposing (..)
2015-10-14 19:02:13 +00:00
import Dict
tests : Test
tests = suite "GradeSchool Test Suite"
[
test "add student" (assertEqual [(2, ["Aimee"])]
(S.schoolToList (S.addStudent 2 "Aimee" S.newSchool))),
test "add more students in same class" (assertEqual [(2, ["Blair", "James", "Paul"])]
(S.schoolToList (S.gradeWithStudents 2 ["James", "Blair", "Paul"]))),
test "add students to different grades" (assertEqual [(3, ["Chelsea"]), (7, ["Logan"])]
(S.schoolToList (S.schoolFromList [(3, "Chelsea"), (7, "Logan")]))),
test "get students in a grade" (assertEqual ["Bradley", "Franklin"]
(S.studentsInGrade 5 (S.schoolFromList [(5, "Franklin"), (5, "Bradley"), (1, "Jeff")]))),
test "get students in a non-existent grade" (assertEqual [] (S.studentsInGrade 1 S.newSchool))
]
port runner : Signal (Task.Task x ())
port runner =
Console.run (consoleRunner tests)