Skip to content

Commit 92ce20f

Browse files
committed
Adding tests for aliases
1 parent 166f798 commit 92ce20f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/enumerable_stats_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,15 @@ def to_f
941941
end
942942
end
943943

944+
describe "#greater_than? alias" do
945+
it "returns true when first collection has significantly greater mean" do
946+
control = [10, 12, 11, 13, 12, 9, 14, 11, 10, 13] # mean ≈ 11.5
947+
treatment = [15, 17, 16, 18, 14, 19, 16, 17, 15, 18] # mean ≈ 16.5
948+
949+
expect(treatment > control).to be true
950+
end
951+
end
952+
944953
describe "#greater_than?" do
945954
it "returns true when first collection has significantly greater mean" do
946955
control = [10, 12, 11, 13, 12, 9, 14, 11, 10, 13] # mean ≈ 11.5
@@ -1063,6 +1072,16 @@ def to_f
10631072
end
10641073
end
10651074

1075+
describe "#less_than? alias" do
1076+
it "returns true when first collection has significantly lower mean" do
1077+
baseline = [150, 165, 155, 170, 160, 145, 175, 152, 158, 163] # mean ≈ 159
1078+
optimized = [120, 125, 115, 130, 118, 122, 128, 124, 119, 126] # mean ≈ 122
1079+
1080+
expect(optimized.less_than?(baseline)).to be true
1081+
expect(baseline.less_than?(optimized)).to be false
1082+
end
1083+
end
1084+
10661085
describe "#less_than?" do
10671086
it "returns true when first collection has significantly lower mean" do
10681087
baseline = [150, 165, 155, 170, 160, 145, 175, 152, 158, 163] # mean ≈ 159

0 commit comments

Comments
 (0)