/*-
 * #%L
 * Java implementation of the SciJava Ops matching engine.
 * %%
 * Copyright (C) 2016 - 2024 SciJava developers.
 * %%
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * #L%
 */
/*
 * This is autogenerated source code -- DO NOT EDIT. Instead, edit the
 * corresponding template in templates/ and rerun bin/generate.groovy.
 */

package org.scijava.ops.engine.adapt.complexLift;

import java.util.Arrays;
import java.util.List;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.scijava.ops.engine.AbstractTestEnvironment;
import org.scijava.ops.engine.adapt.functional.FunctionToComputerAdaptTestOps;
import org.scijava.ops.engine.adapt.functional.FunctionsToComputers;
import org.scijava.ops.engine.adapt.lift.ComputerToIterables;
import org.scijava.ops.engine.copy.CopyOpCollection;

public class FunctionToComputerIterablesTest extends AbstractTestEnvironment {

	@BeforeAll
	public static void AddNeededOps() {
		Object[] lifterOps = objsFromNoArgConstructors(FunctionsToComputersAndLift.class.getDeclaredClasses());
		ops.register(lifterOps);
		ops.register(new ComputerToIterables());
		Object[] adapterOps = objsFromNoArgConstructors(FunctionsToComputers.class.getDeclaredClasses());
		ops.register(adapterOps);
		ops.register(new CopyOpCollection());
		ops.register(new FunctionToComputerAdaptTestOps());
	}

	@Test
	public void testFunction1ToComputer1() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {2, 4}, output.get(0), 0);
	}

	@Test
	public void testFunction2ToComputer2() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {4, 8}, output.get(0), 0);
	}

	@Test
	public void testFunction3ToComputer3() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {6, 12}, output.get(0), 0);
	}

	@Test
	public void testFunction4ToComputer4() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {8, 16}, output.get(0), 0);
	}

	@Test
	public void testFunction5ToComputer5() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {10, 20}, output.get(0), 0);
	}

	@Test
	public void testFunction6ToComputer6() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {12, 24}, output.get(0), 0);
	}

	@Test
	public void testFunction7ToComputer7() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {14, 28}, output.get(0), 0);
	}

	@Test
	public void testFunction8ToComputer8() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {16, 32}, output.get(0), 0);
	}

	@Test
	public void testFunction9ToComputer9() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {18, 36}, output.get(0), 0);
	}

	@Test
	public void testFunction10ToComputer10() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {20, 40}, output.get(0), 0);
	}

	@Test
	public void testFunction11ToComputer11() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {22, 44}, output.get(0), 0);
	}

	@Test
	public void testFunction12ToComputer12() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in, in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {24, 48}, output.get(0), 0);
	}

	@Test
	public void testFunction13ToComputer13() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in, in, in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {26, 52}, output.get(0), 0);
	}

	@Test
	public void testFunction14ToComputer14() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in, in, in, in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {28, 56}, output.get(0), 0);
	}

	@Test
	public void testFunction15ToComputer15() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in, in, in, in, in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {30, 60}, output.get(0), 0);
	}

	@Test
	public void testFunction16ToComputer16() {
		List<double[]> in = Arrays.asList(new double[] { 2, 4 });
		List<double[]> output = Arrays.asList(new double[] { 0, 0 });
		ops.op("test.FtC").input(in, in, in, in, in, in, in, in, in, in, in, in, in, in, in, in).output(output).compute();
		Assertions.assertArrayEquals(new double[] {32, 64}, output.get(0), 0);
	}
}

