1
2
3
4
5
6
7
8
9
10
11
12
13
14 package fuzzy.util;
15
16 import static org.junit.Assert.assertTrue;
17
18 import java.util.Collection;
19 import java.util.Map;
20
21 import org.apache.commons.functor.generator.range.DoubleRange;
22 import org.junit.Test;
23
24 import fuzzy.mf.MembershipFunction;
25 import fuzzy.mf.TrapezoidalMembershipFunction;
26
27
28
29
30
31
32
33 public class TestMaxMF {
34
35 @Test
36 public void testMaxMF() {
37 Collection<Double> values = new DoubleRange(-10.0, 30.0, 0.1).toCollection();
38 MembershipFunction<Double> mf = new TrapezoidalMembershipFunction(-5.0, -2.0, 10.0, 20.0);
39 Map<Double, Double> r = MaxMF.of(values, mf);
40
41 assertTrue(r.containsValue(Double.valueOf(1.0)));
42 }
43
44 }