2017-05-27 17:56:31 +00:00
|
|
|
module Tests exposing (..)
|
2015-10-14 19:02:13 +00:00
|
|
|
|
2016-08-17 11:14:17 +00:00
|
|
|
import Test exposing (..)
|
|
|
|
import Expect
|
2016-03-17 01:16:54 +00:00
|
|
|
import GradeSchool exposing (addStudent, studentsInGrade, allStudents)
|
2015-10-14 19:02:13 +00:00
|
|
|
|
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 =
|
2016-08-17 11:14:17 +00:00
|
|
|
describe "GradeSchool"
|
|
|
|
[ test "add student" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal [ "Aimee" ]
|
|
|
|
(GradeSchool.empty
|
|
|
|
|> addStudent 2 "Aimee"
|
|
|
|
|> studentsInGrade 2
|
|
|
|
)
|
2017-07-05 20:35:15 +00:00
|
|
|
, skip <|
|
|
|
|
test "add more students in same class" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal [ "Blair", "James", "Paul" ]
|
|
|
|
(GradeSchool.empty
|
|
|
|
|> addStudent 2 "James"
|
|
|
|
|> addStudent 2 "Blair"
|
|
|
|
|> addStudent 2 "Paul"
|
|
|
|
|> studentsInGrade 2
|
|
|
|
)
|
|
|
|
, skip <|
|
|
|
|
test "add students to different grades" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal [ [ "Chelsea" ], [ "Logan" ] ]
|
|
|
|
(let
|
|
|
|
school =
|
|
|
|
GradeSchool.empty
|
|
|
|
|> addStudent 3 "Chelsea"
|
|
|
|
|> addStudent 7 "Logan"
|
|
|
|
in
|
|
|
|
[ studentsInGrade 3 school, studentsInGrade 7 school ]
|
|
|
|
)
|
|
|
|
, skip <|
|
|
|
|
test "get students in a grade" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal [ "Bradley", "Franklin" ]
|
|
|
|
(GradeSchool.empty
|
|
|
|
|> addStudent 5 "Franklin"
|
|
|
|
|> addStudent 5 "Bradley"
|
|
|
|
|> addStudent 1 "Jeff"
|
|
|
|
|> studentsInGrade 5
|
|
|
|
)
|
|
|
|
, skip <|
|
|
|
|
test "get all students in the school" <|
|
|
|
|
\() ->
|
|
|
|
Expect.equal [ ( 3, [ "Kyle" ] ), ( 4, [ "Christopher", "Jennifer" ] ), ( 6, [ "Kareem" ] ) ]
|
|
|
|
(GradeSchool.empty
|
|
|
|
|> addStudent 4 "Jennifer"
|
|
|
|
|> addStudent 6 "Kareem"
|
|
|
|
|> addStudent 4 "Christopher"
|
|
|
|
|> addStudent 3 "Kyle"
|
|
|
|
|> allStudents
|
|
|
|
)
|
|
|
|
, skip <|
|
|
|
|
test "get students in a non-existent grade" <|
|
|
|
|
\() -> Expect.equal [] (studentsInGrade 1 GradeSchool.empty)
|
2016-06-19 21:46:13 +00:00
|
|
|
]
|