Search in sources :

Example 16 with Transform

use of com.sun.tck.lib.tgf.Transform in project jtharness by openjdk.

the class TestTransformingIterator method testToString.

@Test
public void testToString() {
    TransformingIterator iterator = new TransformingIterator(new LeafIterator(1, 2, 3), new Object() {

        @Transform
        int transform(int i) {
            return i;
        }
    });
    Assert.assertEquals("0", iterator.toString());
}
Also used : TransformingIterator(com.sun.tck.lib.tgf.TransformingIterator) LeafIterator(com.sun.tck.lib.tgf.LeafIterator) Transform(com.sun.tck.lib.tgf.Transform) Test(org.junit.Test)

Example 17 with Transform

use of com.sun.tck.lib.tgf.Transform in project jtharness by openjdk.

the class Filters method test_5_firstOut_pseudoMultiply.

@Test
public void test_5_firstOut_pseudoMultiply() {
    Values values = createColumn(0, 1, 2);
    values = values.filter(new Object() {

        @Transform
        Integer filter(int i) {
            return i != 0 ? i : null;
        }
    }).pseudoMultiply("a", "b", "c");
    List<Object[]> expected = new ArrayList<Object[]>();
    expected.add(new Object[] { 1, "a" });
    expected.add(new Object[] { 2, "b" });
    expected.add(new Object[] { 1, "c" });
    ValuesComparison.compare(values, expected);
}
Also used : DataFactory.createValues(com.sun.tck.lib.tgf.DataFactory.createValues) Values(com.sun.tck.lib.tgf.Values) ArrayList(java.util.ArrayList) Transform(com.sun.tck.lib.tgf.Transform) Test(org.junit.Test)

Example 18 with Transform

use of com.sun.tck.lib.tgf.Transform in project jtharness by openjdk.

the class Filters method test_5_lastTwoOut_unite.

@Test
public void test_5_lastTwoOut_unite() {
    Values values = createColumn(0, 1, 2, 3, 4);
    values = values.filter(new Object() {

        @Transform
        Integer filter(int i) {
            return i < 2 ? i : null;
        }
    }).unite("a", "b", "c");
    List<Object[]> expected = new ArrayList<Object[]>();
    expected.add(new Object[] { 0 });
    expected.add(new Object[] { 1 });
    expected.add(new Object[] { "a" });
    expected.add(new Object[] { "b" });
    expected.add(new Object[] { "c" });
    ValuesComparison.compare(values, expected);
}
Also used : DataFactory.createValues(com.sun.tck.lib.tgf.DataFactory.createValues) Values(com.sun.tck.lib.tgf.Values) ArrayList(java.util.ArrayList) Transform(com.sun.tck.lib.tgf.Transform) Test(org.junit.Test)

Example 19 with Transform

use of com.sun.tck.lib.tgf.Transform in project jtharness by openjdk.

the class Filters method test_5_thirdOut_unite.

@Test
public void test_5_thirdOut_unite() {
    Values values = createColumn(0, 1, 2);
    values = values.filter(new Object() {

        @Transform
        Integer filter(int i) {
            return i != 2 ? i : null;
        }
    }).unite("a", "b", "c");
    List<Object[]> expected = new ArrayList<Object[]>();
    expected.add(new Object[] { 0 });
    expected.add(new Object[] { 1 });
    expected.add(new Object[] { "a" });
    expected.add(new Object[] { "b" });
    expected.add(new Object[] { "c" });
    ValuesComparison.compare(values, expected);
}
Also used : DataFactory.createValues(com.sun.tck.lib.tgf.DataFactory.createValues) Values(com.sun.tck.lib.tgf.Values) ArrayList(java.util.ArrayList) Transform(com.sun.tck.lib.tgf.Transform) Test(org.junit.Test)

Example 20 with Transform

use of com.sun.tck.lib.tgf.Transform in project jtharness by openjdk.

the class Filters method test_4.

@Test
public void test_4() {
    Values values_2 = createColumn(1, 2).filter(new Object() {

        @Transform
        Values filter(int i) {
            return createValues(new Object[][] { { i, i + 1 }, { i + 2, i + 3 } });
        }
    });
    Values values_1 = createColumn(3, 4);
    Values result = values_1.multiply(values_2);
    List<Object[]> expected = new ArrayList<Object[]>();
    expected.add(new Object[] { 3, 1, 2 });
    expected.add(new Object[] { 3, 3, 4 });
    expected.add(new Object[] { 3, 2, 3 });
    expected.add(new Object[] { 3, 4, 5 });
    expected.add(new Object[] { 4, 1, 2 });
    expected.add(new Object[] { 4, 3, 4 });
    expected.add(new Object[] { 4, 2, 3 });
    expected.add(new Object[] { 4, 4, 5 });
    ValuesComparison.compare(result, expected);
}
Also used : DataFactory.createValues(com.sun.tck.lib.tgf.DataFactory.createValues) Values(com.sun.tck.lib.tgf.Values) ArrayList(java.util.ArrayList) Transform(com.sun.tck.lib.tgf.Transform) Test(org.junit.Test)

Aggregations

Transform (com.sun.tck.lib.tgf.Transform)31 Test (org.junit.Test)31 DataFactory.createValues (com.sun.tck.lib.tgf.DataFactory.createValues)30 Values (com.sun.tck.lib.tgf.Values)30 ArrayList (java.util.ArrayList)30 LeafIterator (com.sun.tck.lib.tgf.LeafIterator)1 TransformingIterator (com.sun.tck.lib.tgf.TransformingIterator)1