

package net.imagej.ops.logic;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import net.imagej.ops.AbstractOpTest;
import net.imglib2.type.logic.BoolType;

import org.junit.Test;

/** Tests {@link OrCondition}. */
public class OrConditionTest extends AbstractOpTest {

	@Test
	public void test() {
		@SuppressWarnings("unchecked")
		final Condition<Object> c1 =
			ops.op(ComparableGreaterThan.class, Double.class, 3.0);
		@SuppressWarnings("unchecked")
		final Condition<Object> c2 =
			ops.op(ComparableLessThan.class, Double.class, 6.0);
		final Condition<Object> c3 =
			ops.op(ObjectsEqual.class, Double.class, 13.0);

		final BoolType result = ops.logic().or(5.0, c1, c2);
		assertTrue(result.get());

		final BoolType result2 = ops.logic().or(2.0, c1, c2);
		assertTrue(result2.get());

		final BoolType result3 = ops.logic().or(7.0, c1, c2);
		assertTrue(result3.get());

		final BoolType result4 = ops.logic().or(2.0, c1, c3);
		assertFalse(result4.get());
	}

}
