Search in sources :

Example 11 with Transform

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

the class Filters method test_nothingLeft_doubleFiltering_2.

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

        @Transform
        Integer filter(int i) {
            return null;
        }
    }).filter(new Object() {

        @Transform
        Integer filter() {
            return 15;
        }
    });
    List<Object[]> expected = new ArrayList<Object[]>();
    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 12 with Transform

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

the class Filters method test_5_lastTwoOut_mult.

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

        @Transform
        Integer filter(int i) {
            return i < 2 ? i : null;
        }
    }).multiply("a", "b", "c");
    List<Object[]> expected = new ArrayList<Object[]>();
    expected.add(new Object[] { 0, "a" });
    expected.add(new Object[] { 0, "b" });
    expected.add(new Object[] { 0, "c" });
    expected.add(new Object[] { 1, "a" });
    expected.add(new Object[] { 1, "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 13 with Transform

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

the class Filters method test_4_cache.

@Test
public void test_4_cache() {
    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.createCache(), 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 14 with Transform

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

the class Filters method test_5_secondOut.

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

        @Transform
        Integer filter(int i) {
            return i != 1 ? i : null;
        }
    }).multiply("a", "b", "c");
    List<Object[]> expected = new ArrayList<Object[]>();
    expected.add(new Object[] { 0, "a" });
    expected.add(new Object[] { 0, "b" });
    expected.add(new Object[] { 0, "c" });
    expected.add(new Object[] { 2, "a" });
    expected.add(new Object[] { 2, "b" });
    expected.add(new Object[] { 2, "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 15 with Transform

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

the class Filters method test_5_firstTwoOut.

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

        @Transform
        Integer filter(int i) {
            return i > 1 ? i : null;
        }
    }).multiply("a", "b", "c");
    List<Object[]> expected = new ArrayList<Object[]>();
    expected.add(new Object[] { 2, "a" });
    expected.add(new Object[] { 2, "b" });
    expected.add(new Object[] { 2, "c" });
    expected.add(new Object[] { 3, "a" });
    expected.add(new Object[] { 3, "b" });
    expected.add(new Object[] { 3, "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)

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