Skip to content

Commit 4413c89

Browse files
committed
add tests for even numbered arrays
1 parent 1fb124d commit 4413c89

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

spec/Median/MedianSpec.php

+21
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,25 @@ function it_should_return_a_median_of_9_for_1_4_7_9_11_100_250_3_14()
5757
$this->beConstructedWith($array);
5858
$this->median($array)->shouldEqual(9);
5959
}
60+
61+
function it_should_return_a_median_of_3point5_for_1_2_3_4_5_6()
62+
{
63+
$array = [1,2,3,4,5,6];
64+
$this->beConstructedWith($array);
65+
$this->median($array)->shouldEqual(3.5);
66+
}
67+
68+
function it_should_return_a_median_of_4point5_for_1_2_3_4_5_6_7_8()
69+
{
70+
$array = [1,2,3,4,5,6,7,8];
71+
$this->beConstructedWith($array);
72+
$this->median($array)->shouldEqual(4.5);
73+
}
74+
75+
function it_should_return_a_median_of_56_for_66_13_46_378_336_26_4_77_5_92()
76+
{
77+
$array = [66,13,46,378,336,26,4,77,5,92];
78+
$this->beConstructedWith($array);
79+
$this->median($array)->shouldEqual(56);
80+
}
6081
}

0 commit comments

Comments
 (0)