1
2
3
4
5
6
7
8
9
10
11
12
13
14 package fuzzy.util;
15
16 import static org.junit.Assert.assertEquals;
17 import static org.junit.Assert.assertTrue;
18
19 import java.util.Collection;
20
21 import org.apache.commons.functor.generator.range.DoubleRange;
22 import org.junit.Test;
23
24 import fuzzy.mf.GeneralizedBellShapedMembershipFunction;
25 import fuzzy.mf.MembershipFunction;
26
27
28
29
30
31
32
33 public class TestCrispFuzzyProduct {
34
35 @Test
36 public void testCrispFuzzyProduct() {
37 Collection<Double> col = new DoubleRange(0.0, 1.0, 0.1).toCollection();
38 MembershipFunction<Double> mf = new GeneralizedBellShapedMembershipFunction(0.2, 0.5, 0.8);
39 Collection<Double> r = CrispFuzzyProduct.of(col, mf);
40 assertTrue(r.size() == 11);
41 assertEquals(Double.valueOf(0.0), r.iterator().next());
42 }
43
44 }