Search in sources :

Example 6 with Transform

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

the class Filters method test_7_lastOut.

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

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

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

the class Filters method test_nothingLeft_createCache.

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

        @Transform
        Integer filter(int i) {
            return null;
        }
    }).createCache();
    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 8 with Transform

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

the class Filters method test_5_firstOut_intersect.

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

        @Transform
        Integer filter(int i) {
            return i != 0 ? i : null;
        }
    }).intersect(0, 4, 6, 1, 8, 9, 2);
    List<Object[]> expected = new ArrayList<Object[]>();
    expected.add(new Object[] { 1 });
    expected.add(new Object[] { 2 });
    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 9 with Transform

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

the class Filters method test_6_secondOut.

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

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

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

the class Filters method test_nothingLeft_middle.

@Test
public void test_nothingLeft_middle() {
    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 2;
        }
    });
    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)

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