/*
 * Java Genetic Algorithm Library (@__identifier__@).
 * Copyright (c) @__year__@ Franz Wilhelmstötter
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Author:
 *    Franz Wilhelmstötter (franz.wilhelmstoetter@gmail.com)
 */
package io.jenetics.prog.op;

import org.testng.Assert;
import org.testng.annotations.Test;

import io.jenetics.ext.util.TreeNode;

/**
 * @author <a href="mailto:franz.wilhelmstoetter@gmail.com">Franz Wilhelmstötter</a>
 */
public class BoolOpTest {


	@Test
	public void toBoolOp() {
		final TreeNode<Op<Boolean>> tree = TreeNode.parse(
			"and(xor(x[0],y[1]),eq(y[1],x[0]))",
			BoolOp::toBoolOp
		);
		Assert.assertFalse(Program.eval(tree, true, true));
	}

}

@@ -989,16 +989,1492 @@
 Test %7B%0A%0A
+%09@Test%0A%09public void and() %7B%0A%09%09Assert.assertEquals(BoolOp.AND.eval(false, false), false);%0A%09%09Assert.assertEquals(BoolOp.AND.eval(false, true), false);%0A%09%09Assert.assertEquals(BoolOp.AND.eval(true, false), false);%0A%09%09Assert.assertEquals(BoolOp.AND.eval(true, true), true);%0A%09%7D%0A%0A%09@Test%0A%09public void or() %7B%0A%09%09Assert.assertEquals(BoolOp.OR.eval(false, false), false);%0A%09%09Assert.assertEquals(BoolOp.OR.eval(false, true), true);%0A%09%09Assert.assertEquals(BoolOp.OR.eval(true, false), true);%0A%09%09Assert.assertEquals(BoolOp.OR.eval(true, true), true);%0A%09%7D%0A%0A%09@Test%0A%09public void xor() %7B%0A%09%09Assert.assertEquals(BoolOp.XOR.eval(false, false), false);%0A%09%09Assert.assertEquals(BoolOp.XOR.eval(false, true), true);%0A%09%09Assert.assertEquals(BoolOp.XOR.eval(true, false), true);%0A%09%09Assert.assertEquals(BoolOp.XOR.eval(true, true), false);%0A%09%7D%0A%0A%09@Test%0A%09public void imp() %7B%0A%09%09Assert.assertEquals(BoolOp.IMP.eval(false, false), true);%0A%09%09Assert.assertEquals(BoolOp.IMP.eval(false, true), true);%0A%09%09Assert.assertEquals(BoolOp.IMP.eval(true, false), false);%0A%09%09Assert.assertEquals(BoolOp.IMP.eval(true, true), true);%0A%09%7D%0A%0A%09@Test%0A%09public void eq() %7B%0A%09%09Assert.assertEquals(BoolOp.EQ.eval(false, false), true);%0A%09%09Assert.assertEquals(BoolOp.EQ.eval(false, true), false);%0A%09%09Assert.assertEquals(BoolOp.EQ.eval(true, false), false);%0A%09%09Assert.assertEquals(BoolOp.EQ.eval(true, true), true);%0A%09%7D%0A%0A%09@Test%0A%09public void not() %7B%0A%09%09Assert.assertEquals(BoolOp.NOT.eval(false), true);%0A%09%09Assert.assertEquals(BoolOp.NOT.eval(true), false);%0A%09%7D%0A
 %0A%09@Test%0A

Implement unit-tests.