001: /**
002: *
003: */package org.drools.common;
004:
005: import org.drools.Cheese;
006: import org.drools.base.evaluators.Operator;
007: import org.drools.rule.VariableConstraint;
008:
009: /**
010: * @author etirelli
011: *
012: */
013: public class QuadroupleBetaConstraintsTest extends
014: BaseBetaConstraintsTest {
015:
016: public void testNoneIndxed() {
017: VariableConstraint constraint0 = (VariableConstraint) getConstraint(
018: "cheeseType0", Operator.NOT_EQUAL, "type", Cheese.class);
019: VariableConstraint constraint1 = (VariableConstraint) getConstraint(
020: "cheeseType1", Operator.NOT_EQUAL, "type", Cheese.class);
021: VariableConstraint constraint3 = (VariableConstraint) getConstraint(
022: "cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
023: VariableConstraint constraint4 = (VariableConstraint) getConstraint(
024: "cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
025: VariableConstraint[] constraints = new VariableConstraint[] {
026: constraint0, constraint1, constraint3, constraint4 };
027: checkBetaConstraints(constraints,
028: QuadroupleBetaConstraints.class);
029: }
030:
031: public void testOneIndxed() {
032: VariableConstraint constraint0 = (VariableConstraint) getConstraint(
033: "cheeseType0", Operator.EQUAL, "type", Cheese.class);
034: VariableConstraint constraint1 = (VariableConstraint) getConstraint(
035: "cheeseType1", Operator.NOT_EQUAL, "type", Cheese.class);
036: VariableConstraint constraint3 = (VariableConstraint) getConstraint(
037: "cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
038: VariableConstraint constraint4 = (VariableConstraint) getConstraint(
039: "cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
040: VariableConstraint[] constraints = new VariableConstraint[] {
041: constraint0, constraint1, constraint3, constraint4 };
042: checkBetaConstraints(constraints,
043: QuadroupleBetaConstraints.class);
044:
045: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
046: Operator.NOT_EQUAL, "type", Cheese.class);
047: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
048: Operator.EQUAL, "type", Cheese.class);
049: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
050: Operator.NOT_EQUAL, "type", Cheese.class);
051: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
052: Operator.NOT_EQUAL, "type", Cheese.class);
053: constraints = new VariableConstraint[] { constraint0,
054: constraint1, constraint3, constraint4 };
055: checkBetaConstraints(constraints,
056: QuadroupleBetaConstraints.class);
057:
058: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
059: Operator.NOT_EQUAL, "type", Cheese.class);
060: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
061: Operator.NOT_EQUAL, "type", Cheese.class);
062: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
063: Operator.EQUAL, "type", Cheese.class);
064: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
065: Operator.NOT_EQUAL, "type", Cheese.class);
066: constraints = new VariableConstraint[] { constraint0,
067: constraint1, constraint3, constraint4 };
068: checkBetaConstraints(constraints,
069: QuadroupleBetaConstraints.class);
070:
071: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
072: Operator.NOT_EQUAL, "type", Cheese.class);
073: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
074: Operator.NOT_EQUAL, "type", Cheese.class);
075: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
076: Operator.NOT_EQUAL, "type", Cheese.class);
077: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
078: Operator.EQUAL, "type", Cheese.class);
079: constraints = new VariableConstraint[] { constraint0,
080: constraint1, constraint3, constraint4 };
081: checkBetaConstraints(constraints,
082: QuadroupleBetaConstraints.class);
083: }
084:
085: public void testTwoIndxed() {
086: VariableConstraint constraint0 = (VariableConstraint) getConstraint(
087: "cheeseType0", Operator.EQUAL, "type", Cheese.class);
088: VariableConstraint constraint1 = (VariableConstraint) getConstraint(
089: "cheeseType1", Operator.EQUAL, "type", Cheese.class);
090: VariableConstraint constraint3 = (VariableConstraint) getConstraint(
091: "cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
092: VariableConstraint constraint4 = (VariableConstraint) getConstraint(
093: "cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
094: VariableConstraint[] constraints = new VariableConstraint[] {
095: constraint0, constraint1, constraint3, constraint4 };
096: checkBetaConstraints(constraints,
097: QuadroupleBetaConstraints.class);
098:
099: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
100: Operator.EQUAL, "type", Cheese.class);
101: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
102: Operator.NOT_EQUAL, "type", Cheese.class);
103: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
104: Operator.EQUAL, "type", Cheese.class);
105: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
106: Operator.NOT_EQUAL, "type", Cheese.class);
107: constraints = new VariableConstraint[] { constraint0,
108: constraint1, constraint3, constraint4 };
109: checkBetaConstraints(constraints,
110: QuadroupleBetaConstraints.class);
111:
112: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
113: Operator.EQUAL, "type", Cheese.class);
114: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
115: Operator.NOT_EQUAL, "type", Cheese.class);
116: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
117: Operator.NOT_EQUAL, "type", Cheese.class);
118: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
119: Operator.EQUAL, "type", Cheese.class);
120: constraints = new VariableConstraint[] { constraint0,
121: constraint1, constraint3, constraint4 };
122: checkBetaConstraints(constraints,
123: QuadroupleBetaConstraints.class);
124:
125: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
126: Operator.NOT_EQUAL, "type", Cheese.class);
127: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
128: Operator.EQUAL, "type", Cheese.class);
129: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
130: Operator.EQUAL, "type", Cheese.class);
131: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
132: Operator.NOT_EQUAL, "type", Cheese.class);
133: constraints = new VariableConstraint[] { constraint0,
134: constraint1, constraint3, constraint4 };
135: checkBetaConstraints(constraints,
136: QuadroupleBetaConstraints.class);
137:
138: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
139: Operator.NOT_EQUAL, "type", Cheese.class);
140: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
141: Operator.EQUAL, "type", Cheese.class);
142: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
143: Operator.NOT_EQUAL, "type", Cheese.class);
144: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
145: Operator.EQUAL, "type", Cheese.class);
146: constraints = new VariableConstraint[] { constraint0,
147: constraint1, constraint3, constraint4 };
148: checkBetaConstraints(constraints,
149: QuadroupleBetaConstraints.class);
150:
151: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
152: Operator.NOT_EQUAL, "type", Cheese.class);
153: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
154: Operator.NOT_EQUAL, "type", Cheese.class);
155: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
156: Operator.EQUAL, "type", Cheese.class);
157: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
158: Operator.EQUAL, "type", Cheese.class);
159: constraints = new VariableConstraint[] { constraint0,
160: constraint1, constraint3, constraint4 };
161: checkBetaConstraints(constraints,
162: QuadroupleBetaConstraints.class);
163: }
164:
165: public void testThreeIndxed() {
166: VariableConstraint constraint0 = (VariableConstraint) getConstraint(
167: "cheeseType0", Operator.EQUAL, "type", Cheese.class);
168: VariableConstraint constraint1 = (VariableConstraint) getConstraint(
169: "cheeseType1", Operator.EQUAL, "type", Cheese.class);
170: VariableConstraint constraint3 = (VariableConstraint) getConstraint(
171: "cheeseType2", Operator.EQUAL, "type", Cheese.class);
172: VariableConstraint constraint4 = (VariableConstraint) getConstraint(
173: "cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
174: VariableConstraint[] constraints = new VariableConstraint[] {
175: constraint0, constraint1, constraint3, constraint4 };
176: checkBetaConstraints(constraints,
177: QuadroupleBetaConstraints.class);
178:
179: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
180: Operator.EQUAL, "type", Cheese.class);
181: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
182: Operator.EQUAL, "type", Cheese.class);
183: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
184: Operator.NOT_EQUAL, "type", Cheese.class);
185: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
186: Operator.EQUAL, "type", Cheese.class);
187: constraints = new VariableConstraint[] { constraint0,
188: constraint1, constraint3, constraint4 };
189: checkBetaConstraints(constraints,
190: QuadroupleBetaConstraints.class);
191:
192: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
193: Operator.EQUAL, "type", Cheese.class);
194: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
195: Operator.NOT_EQUAL, "type", Cheese.class);
196: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
197: Operator.EQUAL, "type", Cheese.class);
198: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
199: Operator.EQUAL, "type", Cheese.class);
200: constraints = new VariableConstraint[] { constraint0,
201: constraint1, constraint3, constraint4 };
202: checkBetaConstraints(constraints,
203: QuadroupleBetaConstraints.class);
204:
205: constraint0 = (VariableConstraint) getConstraint("cheeseType0",
206: Operator.NOT_EQUAL, "type", Cheese.class);
207: constraint1 = (VariableConstraint) getConstraint("cheeseType1",
208: Operator.EQUAL, "type", Cheese.class);
209: constraint3 = (VariableConstraint) getConstraint("cheeseType2",
210: Operator.EQUAL, "type", Cheese.class);
211: constraint4 = (VariableConstraint) getConstraint("cheeseType3",
212: Operator.EQUAL, "type", Cheese.class);
213: constraints = new VariableConstraint[] { constraint0,
214: constraint1, constraint3, constraint4 };
215: checkBetaConstraints(constraints,
216: QuadroupleBetaConstraints.class);
217: }
218:
219: public void testFourIndxed() {
220: VariableConstraint constraint0 = (VariableConstraint) getConstraint(
221: "cheeseType0", Operator.EQUAL, "type", Cheese.class);
222: VariableConstraint constraint1 = (VariableConstraint) getConstraint(
223: "cheeseType1", Operator.EQUAL, "type", Cheese.class);
224: VariableConstraint constraint3 = (VariableConstraint) getConstraint(
225: "cheeseType2", Operator.EQUAL, "type", Cheese.class);
226: VariableConstraint constraint4 = (VariableConstraint) getConstraint(
227: "cheeseType3", Operator.EQUAL, "type", Cheese.class);
228: VariableConstraint[] constraints = new VariableConstraint[] {
229: constraint0, constraint1, constraint3, constraint4 };
230: checkBetaConstraints(constraints,
231: QuadroupleBetaConstraints.class);
232: }
233:
234: }
|