use of primal.primitive.Int_Int in project suite by stupidsing.
the class BinarySearchTest method testDesc.
private void testDesc(int l) {
Int_Int f = i -> l + 1 - i;
var is = NewInt.array(l, f);
assertEquals(l - 1, searchDesc(is, Integer.MIN_VALUE));
assertEquals(-1, searchDesc(is, Integer.MAX_VALUE));
for (var i = 0; i < l; i++) assertEquals(i, searchDesc(is, f.apply(i)));
}
use of primal.primitive.Int_Int in project suite by stupidsing.
the class FunCreatorTest method testObject.
@Test
public void testObject() {
Int_Int inc = i -> i + 1;
Iterate<FunExpr> fun = i -> f.object(inc).invoke("apply", i);
assertEquals(3, LambdaInstance.of(Int_Int.class, fun).newFun().apply(2));
}
use of primal.primitive.Int_Int in project suite by stupidsing.
the class BinarySearchTest method testAsc.
private void testAsc(int l) {
Int_Int f = i -> i;
var is = NewInt.array(l, f);
assertEquals(0, searchAsc(is, Integer.MIN_VALUE));
assertEquals(l, searchAsc(is, Integer.MAX_VALUE));
for (var i = 0; i < l; i++) assertEquals(i, searchAsc(is, f.apply(i)));
}
Aggregations