2016-03-17 01:38:35 +00:00
|
|
|
module Main (..) where
|
2015-10-14 19:02:13 +00:00
|
|
|
|
2016-03-17 01:38:35 +00:00
|
|
|
import Task
|
|
|
|
import Console
|
|
|
|
import ElmTest exposing (..)
|
|
|
|
import GradeSchool as S exposing (..)
|
2015-10-14 19:02:13 +00:00
|
|
|
import Dict
|
|
|
|
|
2016-03-17 01:38:51 +00:00
|
|
|
|
2015-10-14 19:02:13 +00:00
|
|
|
tests : Test
|
2016-03-17 01:38:51 +00:00
|
|
|
tests =
|
|
|
|
suite
|
|
|
|
"GradeSchool"
|
|
|
|
[ 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))
|
|
|
|
]
|
2015-10-14 19:02:13 +00:00
|
|
|
|
2016-03-17 01:38:35 +00:00
|
|
|
|
|
|
|
port runner : Signal (Task.Task x ())
|
|
|
|
port runner =
|
|
|
|
Console.run (consoleRunner tests)
|