Skip to content

Commit d73b022

Browse files
Treiblesschorlegselzer
authored andcommitted
Add auto transform test for Op with secondary arg
1 parent b7f7655 commit d73b022

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/test/java/org/scijava/ops/AutoTransformTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.util.function.Function;
3535

3636
import org.junit.Test;
37+
import org.scijava.ops.core.Computer;
3738
import org.scijava.types.Nil;
3839

3940
import com.google.common.collect.Streams;
@@ -96,6 +97,22 @@ public void autoLiftFuncToArray() {
9697
assert arrayEquals(Arrays.stream(result).mapToDouble(d -> d).toArray(), 1.0, 8.0, 27.0);
9798
}
9899

100+
@Test
101+
public void autoTransformWithSecondaryArgs() {
102+
Computer<Double[], Double[]> power3Arrays = ops().findOp( //
103+
"math.pow", new Nil<Computer<Double[], Double[]>>() {
104+
}, //
105+
new Nil[] { Nil.of(Double[].class), Nil.of(Double[].class), Nil.of(double.class) }, //
106+
Nil.of(Double[].class), //
107+
3.0//
108+
);
109+
110+
Double[] result = new Double[3];
111+
power3Arrays.compute(new Double[] { 1.0, 2.0, 3.0 }, result);
112+
assert arrayEquals(Arrays.stream(result).mapToDouble(d -> d).toArray(), 1.0, 8.0, 27.0);
113+
}
114+
115+
@Test
99116
public void autoCompToFuncAndLift() {
100117
Nil<List<double[]>> n = new Nil<List<double[]>>() {
101118
};

0 commit comments

Comments
 (0)