Skip to content

Commit dfd4dc7

Browse files
committed
Add inplace op to SimplifiedOpInfoTest
1 parent ae14a6e commit dfd4dc7

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scijava-ops-engine/src/test/java/org/scijava/ops/engine/matcher/simplify/SimplifiedOpInfoTest.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.junit.jupiter.api.Test;
4040
import org.scijava.collections.ObjectArray;
4141
import org.scijava.function.Computers;
42+
import org.scijava.function.Inplaces;
4243
import org.scijava.ops.api.Hints;
4344
import org.scijava.ops.engine.AbstractTestEnvironment;
4445
import org.scijava.ops.engine.matcher.impl.OpClassInfo;
@@ -119,6 +120,12 @@ public void testSimplifiedOpFromEnvironment() {
119120
out.addAll(in);
120121
};
121122

123+
@OpField(names = "test.coalesceSimpleDescription")
124+
public final Inplaces.Arity2_1<List<Long>, Long> inplace1 = (in1, in2) -> {
125+
in1.clear();
126+
in1.add(in2);
127+
};
128+
122129
@Test
123130
public void testSimpleDescriptions() {
124131
String actual = ops.unary("test.coalesceSimpleDescription").helpVerbose();
@@ -137,7 +144,14 @@ public void testSimpleDescriptions() {
137144
expected = //
138145
"test.coalesceSimpleDescription:\n\t- (input1, @CONTAINER container1) -> None\n\t- (input1) -> Number";
139146
Assertions.assertEquals(expected, actual);
140-
// Finally test that different number of outputs doesn't retrieve the Ops
147+
148+
// Test that with 2 inputs we do get the binary inplace Op, but no others
149+
actual = ops.binary("test.coalesceSimpleDescription").help();
150+
expected = //
151+
"test.coalesceSimpleDescription:\n\t- (@MUTABLE mutable1, input1) -> None";
152+
Assertions.assertEquals(expected, actual);
153+
154+
// Finally test that with no inputs we don't get any of the Ops
141155
actual = ops.nullary("test.coalesceSimpleDescription").help();
142156
expected = "No Ops found matching this request.";
143157
Assertions.assertEquals(expected, actual);

0 commit comments

Comments
 (0)