Hi
These tests break in 4.8:
private static final Monoid<Option<Integer>> SumMonoidWrapper = Semigroup.intAdditionSemigroup.lift();
@Test
public void sum_of_two_numbers() {
Option<Integer> sum = SumMonoidWrapper.sum(some(3), some(5));
assertThat(sum, is(some(8)));
}
java.lang.AssertionError: Expected: is <Some(8)> but: was <Some(6)>
First argument was added to first (again) instead of the second.
private static final Monoid<Option<Integer>> ProductMonoidWrapper = Semigroup.intMultiplicationSemigroup.lift();
@Test
public void product_of_two_numbers() {
Option<Integer> product = ProductMonoidWrapper.sum(some(3), some(5));
assertThat(product, is(some(10)));
}
java.lang.AssertionError: Expected: is <Some(15)> but: was <Some(9)>
First argument was multiplied by first (again) instead of the second.
But these two work fine so I'm not misinterpreting what sum is supposed to do:
@Test
public void addition_of_two_numbers() {
Integer sum = intAdditionSemigroup.sum(2, 5);
assertThat(sum, is(7));
}
@Test
public void multiplication_of_two_numbers() {
Integer product = intMultiplicationSemigroup.sum(2, 5);
assertThat(product, is(10));
}
Cheers
Marek
Hi
These tests break in 4.8:
java.lang.AssertionError: Expected: is <Some(8)> but: was <Some(6)>First argument was added to first (again) instead of the second.
java.lang.AssertionError: Expected: is <Some(15)> but: was <Some(9)>First argument was multiplied by first (again) instead of the second.
But these two work fine so I'm not misinterpreting what
sumis supposed to do:Cheers
Marek