use of suite.primitive.Int_Int in project suite by stupidsing.
the class FunCreatorTest method testIndex.
@Test
public void testIndex() {
int[] ints = { 0, 1, 4, 9, 16 };
Int_Int fun = LambdaInstance.of(Int_Int.class, i -> f.object(ints).index(i)).newFun();
assertEquals(9, fun.apply(3));
assertEquals(16, fun.apply(4));
}
use of suite.primitive.Int_Int in project suite by stupidsing.
the class FunCreatorTest method testApply0.
@Test
public void testApply0() {
String fieldName0 = "f0";
String fieldName1 = "f1";
FunCreator<Int_Int> fc0 = intFun(fieldName0, Type.INT);
FunCreator<Int_Int> fc1 = intFun(fieldName1, Type.getType(Int_Int.class));
Int_Int f0 = //
fc0.create(//
(i -> f.add(fc0.field(fieldName0), i))).apply(Map.of(fieldName0, 1));
Int_Int f1 = //
fc1.create(//
i -> fc1.field(fieldName1).apply(f.int_(3))).apply(Map.of(fieldName1, f0));
assertEquals(4, f1.apply(5));
}
Aggregations