Sha256: 2f1014b2a64d4fd2bf2f9c60922f8f620fad57d4bb9ccd9ff58a7c7cf3590c80

Contents?: true

Size: 1.56 KB

Versions: 116

Compression:

Stored size: 1.56 KB

Contents

-module(grade_school_tests).

-include_lib("erl_exercism/include/exercism.hrl").
-include_lib("eunit/include/eunit.hrl").

new() ->
  grade_school:new().

add_student_test() ->
  S1 = grade_school:add("Aimee", 2, new()),
  Students = grade_school:get(2, S1),
  ?assertEqual(["Aimee"], lists:sort(Students)).

add_more_students_in_same_class_test() ->
  S1 = grade_school:add("James", 2, new()),
  S2 = grade_school:add("Blair", 2, S1),
  S3 = grade_school:add("Paul", 2, S2),
  Students = grade_school:get(2, S3),
  ?assertEqual(["Blair","James","Paul"], lists:sort(Students)).

add_students_to_different_grades_test() ->
  S1 = grade_school:add("Chelsea", 3, new()),
  S2 = grade_school:add("Logan", 7, S1),

  ?assertEqual(["Chelsea"], grade_school:get(3, S2)),
  ?assertEqual(["Logan"], grade_school:get(7, S2)).

get_students_in_a_grade_test() ->
  S1 = grade_school:add("Franklin", 5, new()),
  S2 = grade_school:add("Bradley", 5, S1),
  S3 = grade_school:add("Jeff", 1, S2),
  Students = grade_school:get(5, S3),
  ?assertEqual(["Bradley","Franklin"], lists:sort(Students)).

get_students_in_a_non_existant_grade_test() ->
  ?assertEqual([], grade_school:get(1, new())).

sort_school_test() ->
  S1 = grade_school:add("Jennifer", 4, new()),
  S2 = grade_school:add("Kareem", 6, S1),
  S3 = grade_school:add("Christopher", 4, S2),
  S4 = grade_school:add("Kyle", 3, S3),

  Sorted = [{3, ["Kyle"]},
            {4, ["Christopher", "Jennifer"]},
            {6, ["Kareem"]}],

  ?assertEqual(Sorted, grade_school:sort(S4)).

version_test() ->
  ?assertMatch(1, grade_school:test_version()).

Version data entries

116 entries across 116 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.179 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.178 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.177 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.176 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.175 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.174 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.173 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.172 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.171 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.170 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.169 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.167 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.166 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.165 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.164 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.163 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.162 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.161 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl
trackler-2.2.1.160 tracks/erlang/exercises/grade-school/test/grade_school_tests.erl