Package com.foundationdb.junit

Examples of com.foundationdb.junit.ParameterizationBuilder


@RunWith(NamedParameterizedRunner.class)
public final class TraversalsPerWritePT extends PTBase {

    @NamedParameterizedRunner.TestParameters
    public static Collection<Parameterization> params() {
        ParameterizationBuilder pb = new ParameterizationBuilder();
        pb.add("");
        pb.multiplyParametersByAppending("1", 1, "20", 20);
        pb.multiplyParametersByAppending("-LEFT", Index.JoinType.LEFT, "-RIGHT", Index.JoinType.RIGHT);
        pb.multiplyParametersByAppending("-narrow", false, "-bushy", true);
        return pb.asList();
    }
View Full Code Here


@RunWith(NamedParameterizedRunner.class)
public final class CastUtilsTest {
   
    @NamedParameterizedRunner.TestParameters
    public static Collection<Parameterization> params() {
        ParameterizationBuilder pb = new ParameterizationBuilder();
        param(pb, "12.5", 13);
        param(pb, "-1299.5", -1300);
        param(pb, "2.0", 2);
        param(pb, "-2.0", -2);
        param(pb, "2.b", 2);
        param(pb, "2.4", 2);
        param(pb, "2.5", 3);
        param(pb, "-2.5", -3);
        param(pb, "", 0);
        param(pb, "a", 0);
        param(pb, "-", 0);
        param(pb, ".", 0);
        param(pb, "-.3", 0);
        param(pb, "-.6", -1);
        param(pb, "+.3", 0);
        param(pb, "+.6", 1);
        param(pb, ".6", 1);
        param(pb, ".6E4", 6000);
        param(pb, "123E4", 1230000);
        param(pb, "123E-4", 0);
        param(pb, "467E-3", 0);
        param(pb, "567E-3", 1);
        param(pb, "123.456E3", 123456);
        param(pb, "27474.83647e-4", 3);

        return pb.asList();
    }
View Full Code Here

    public static final File SCHEMA_FILE = new File(RESOURCE_DIR, "schema.ddl");
    public static final String GROUP_NAME = "customers";

    @NamedParameterizedRunner.TestParameters
    public static Collection<Parameterization> params() {
        ParameterizationBuilder pb = new ParameterizationBuilder();
        pb.add("single", new File(RESOURCE_DIR, GROUP_NAME + ".sql"), GROUP_NAME, false, -1);
        pb.add("single/commit", new File(RESOURCE_DIR, GROUP_NAME + ".sql"),GROUP_NAME, false, 1);
        pb.add("multiple", new File(RESOURCE_DIR, GROUP_NAME + "-m.sql"),GROUP_NAME, true, -1);
        pb.add("multiple/commit", new File(RESOURCE_DIR, GROUP_NAME + "-m.sql"),GROUP_NAME, true, 1);
        pb.add("values", new File(RESOURCE_DIR, "values.sql"), "values", true, 1);
        pb.add("guid", new File(RESOURCE_DIR, "guid.sql"), "guid_table", true, 1);
        pb.add("strings", new File(RESOURCE_DIR, "strings.sql"), "strings", true, 1);
        return pb.asList();
    }
View Full Code Here

@RunWith(NamedParameterizedRunner.class)
public final class IndexScanSelectorTest {

    @NamedParameterizedRunner.TestParameters
    public static Collection<Parameterization> params() {
        ParameterizationBuilder builder = new ParameterizationBuilder();

        builder.add("ONCE", null, null);
        // bitmap descriptors are leaf to root
        param(builder, IndexScanSelector.leftJoinAfter(ais.oiGroupIndex, ais.o), "010");
        param(builder, IndexScanSelector.leftJoinAfter(ais.oiGroupIndex, ais.i), "110");
        param(builder, IndexScanSelector.rightJoinUntil(ais.oiGroupIndex, ais.o), "110");
        param(builder, IndexScanSelector.rightJoinUntil(ais.oiGroupIndex, ais.i), "100");
        param(builder, IndexScanSelector.inner(ais.oiGroupIndex), "110");

        return builder.asList();
    }
View Full Code Here

public final class YamlConfigurationTest {

    @NamedParameterizedRunner.TestParameters
    public static List<Parameterization> parameterizations() throws Exception {
        List<String> fileNames = Strings.dumpResource(YamlConfigurationTest.class, ".");
        ParameterizationBuilder builder = new ParameterizationBuilder();
        for (String fileName : fileNames) {
            if (fileName.startsWith(TEST_PREFIX)) {
                if (fileName.endsWith(TEST_SUFFIX)) {
                    builder.add(fileName, fileName);
                } else if (fileName.endsWith(DISABLED_SUFFIX)) {
                    builder.addFailing(fileName, fileName);
                }
            }
        }
        return builder.asList();
    }
View Full Code Here

@RunWith(NamedParameterizedRunner.class)
public final class WrappingByteSourceCompareToTest {
    @NamedParameterizedRunner.TestParameters
    public static Collection<Parameterization> params() {
        ParameterizationBuilder pb = new ParameterizationBuilder();

        build(pb, bs(), bs(), CompareResult.EQ);
        build(pb, bs(1), bs(), CompareResult.GT);
        build(pb, bs(), bs(1), CompareResult.LT);

        build(pb, bs(5), bs(5), CompareResult.EQ);
        build(pb, bs(5, 1), bs(5), CompareResult.GT);
        build(pb, bs(5), bs(5, 1), CompareResult.LT);

        build(pb, bs(4), bs(5), CompareResult.LT);
        build(pb, bs(4, 1), bs(5), CompareResult.LT);
        build(pb, bs(4), bs(5, 1), CompareResult.LT);

        build(pb, bs(6), bs(5), CompareResult.GT);
        build(pb, bs(6, 1), bs(5), CompareResult.GT);
        build(pb, bs(6), bs(5, 1), CompareResult.GT);

        return pb.asList();
    }
View Full Code Here

@RunWith(NamedParameterizedRunner.class)
public final class BooleanParserTest {

    @TestParameters
    public static Collection<Parameterization> params() {
        ParameterizationBuilder builder = new ParameterizationBuilder();

        param(builder, "1", true);
        param(builder, "1-1", true);
        param(builder, "1.1", true);
        param(builder, "1.1.1.1.1", true);
        param(builder, ".1", true); // this is weird. ".1" as tinyint is 0, and booleans in mysql are tinyint. but
                                    // (false OR ".1") results in a tinyint 1 (ie, true). Gotta love MySQL.
        param(builder, "0.1", true);
        param(builder, "-1", true);
        param(builder, "-1.1-a", true);
        param(builder, ".-1", false);
        param(builder, "-.1", true);
        param(builder, "-..1", false);
        param(builder, "1a", true);
        param(builder, "a1", false); // MySQL doesn't believe in steak sauce
        param(builder, "0", false);
        param(builder, "0.0", false);

        param(builder, "false", false);
        param(builder, "f", false);
        // Following are not MySQL compatible, but required for ActiveRecord.
        param(builder, "true", true);
        param(builder, "t", true);

        return builder.asList();
    }
View Full Code Here

@RunWith(NamedParameterizedRunner.class)
public final class DecimalParserTest {

    @TestParameters
    public static Collection<Parameterization> params() {
        ParameterizationBuilder builder = new ParameterizationBuilder();

        param(builder, "1234.56", 6, 2, "1234.56");
        param(builder, "-1234.56", 6, 2, "-1234.56");
        param(builder, "1234.56", 4, 2, "99.99");
        param(builder, "-1234.56", 4, 2, "-99.99");

        param(builder, "1234", 6, 2, "1234.00");
        param(builder, "12.3456", 4, 2, "12.35");
        param(builder, "1234.56", 6, 0, "1235");
        param(builder, "12.3Q", 4, 2, "12.30");

        return builder.asList();
    }
View Full Code Here

            Pattern.CASE_INSENSITIVE
    );
   
    @TestParameters
    public static Collection<Parameterization> params() throws IOException {
        ParameterizationBuilder pb = new ParameterizationBuilder();
       
        File schema = new File(TESTS_RESOURCE_DIR, "schema.ddl");
        for (File testFile : TESTS_RESOURCE_DIR.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.isFile() && pathname.getName().endsWith(".test");
            }
        })) {
            List<String> testLines = Strings.dumpFile(testFile);
            Iterator<String> testLinesIter = testLines.iterator();
            String sql = testLinesIter.next();
            Map<Set<Map<String,Boolean>>,Integer> tmp = new HashMap<>();
            Set<Map<String,Boolean>> columnEquivalenceSets = new HashSet<>();
            int depth = 0;
            while (testLinesIter.hasNext()) {
                String columnEquivalenceLine = testLinesIter.next().trim();
                Matcher depthMatcher = SUBQUERY_DEPTH_PATTERN.matcher(columnEquivalenceLine);
                if (depthMatcher.matches()) {
                    tmp.put(columnEquivalenceSets, depth);
                    depth = Integer.parseInt(depthMatcher.group(1));
                    columnEquivalenceSets = new HashSet<>();
                    continue;
                }
                Map<String,Boolean> columnEquivalences = new HashMap<>();
                String[] columnNames = readEquivalences(columnEquivalenceLine);
                for (String columnName : columnNames)
                    columnEquivalences.put(columnName, columnNames.length == 1);
                columnEquivalenceSets.add(columnEquivalences);
            }
            tmp.put(columnEquivalenceSets, depth);
            pb.add(stripr(testFile.getName(), ".test"), schema, sql,  tmp);
        }
       
        return pb.asList();
    }
View Full Code Here

@RunWith(NamedParameterizedRunner.class)
public final class RangeEndpointComparisonTest {
    @NamedParameterizedRunner.TestParameters
    public static Collection<Parameterization> params() {
        ParameterizationBuilder pb = new ParameterizationBuilder();

        // nulls vs nulls
        param(pb,  nullInclusive(AARDVARK), EQ,  nullInclusive(AARDVARK));
        param(pb,  nullInclusive(AARDVARK), LT_BARELY,  nullExclusive(AARDVARK));
        param(pb,  nullExclusive(AARDVARK), EQ,  nullExclusive(AARDVARK));

        // nulls vs "normal" values
        param(pb,  nullInclusive(AARDVARK), LT, inclusive(AARDVARK));
        param(pb,  nullInclusive(AARDVARK), LT, exclusive(AARDVARK));
        param(pb,  nullExclusive(AARDVARK), LT, inclusive(AARDVARK));
        param(pb,  nullExclusive(AARDVARK), LT, exclusive(AARDVARK));

        // nulls vs wild
        param(pb,  nullInclusive(AARDVARK), LT, RangeEndpoint.UPPER_WILD);
        param(pb,  nullExclusive(AARDVARK), LT, RangeEndpoint.UPPER_WILD);

        // normal values vs same values
        param(pb, inclusive(AARDVARK), EQ, inclusive(AARDVARK));
        param(pb, inclusive(AARDVARK), LT_BARELY, exclusive(AARDVARK));

        // normal values vs comparable values
        param(pb, inclusive(AARDVARK), LT, inclusive(CAT));
        param(pb, inclusive(AARDVARK), LT, exclusive(CAT));
        param(pb, exclusive(AARDVARK), LT, inclusive(CAT));
        param(pb, exclusive(AARDVARK), LT, exclusive(CAT));

        // normal values vs wild
        param(pb, inclusive(AARDVARK), LT, RangeEndpoint.UPPER_WILD);
        param(pb, exclusive(AARDVARK), LT, RangeEndpoint.UPPER_WILD);

        // wild vs wild
        param(pb, RangeEndpoint.UPPER_WILD, EQ, RangeEndpoint.UPPER_WILD);

        // incomparable types
        param(pb, inclusive(TWO), INVALID, inclusive(AARDVARK));
        param(pb, inclusive(TWO), INVALID, exclusive(AARDVARK));
        param(pb, exclusive(TWO), INVALID, inclusive(AARDVARK));
        param(pb, exclusive(TWO), INVALID, exclusive(AARDVARK));

        return pb.asList();
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.junit.ParameterizationBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.