Java Code Examples for org.junit.jupiter.params.ParameterizedTest

The following examples show how to use org.junit.jupiter.params.ParameterizedTest. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: yosegi   Source File: TestStringBlockIndex.java    License: Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@MethodSource( "data1" )
public void T_forwardMatch_4( final IBlockIndex index ) throws IOException{
  int[] mustReadIndex = { 0 , 3 };
  IFilter filter = new ForwardMatchStringFilter( "x" );
  List<Integer> resultIndexList = index.getBlockSpreadIndex( filter );
  if( resultIndexList == null ){
    assertTrue( true );
    return;
  }
  Set<Integer> dic = new HashSet<Integer>();
  for( Integer i : resultIndexList ){
    dic.add( i );
  }
  for( int i = 0 ; i < mustReadIndex.length ; i++ ){
    assertTrue( dic.contains( mustReadIndex[i] ) );
  }
}
 
Example 2
Source Project: yosegi   Source File: TestShortPrimitiveColumn.java    License: Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@MethodSource( "data1" )
public void T_notNull_1( final String targetClassName ) throws IOException{
  IColumn column = createNotNullColumn( targetClassName );
  assertEquals( ( (PrimitiveObject)( column.get(0).getRow() ) ).getShort() , Short.MAX_VALUE );
  assertEquals( ( (PrimitiveObject)( column.get(1).getRow() ) ).getShort() , Short.MIN_VALUE );
  assertEquals( ( (PrimitiveObject)( column.get(2).getRow() ) ).getShort() , (short)-200 );
  assertEquals( ( (PrimitiveObject)( column.get(3).getRow() ) ).getShort() , (short)-300 );
  assertEquals( ( (PrimitiveObject)( column.get(4).getRow() ) ).getShort() , (short)-400 );
  assertEquals( ( (PrimitiveObject)( column.get(5).getRow() ) ).getShort() , (short)-500 );
  assertEquals( ( (PrimitiveObject)( column.get(6).getRow() ) ).getShort() , (short)-600 );
  assertEquals( ( (PrimitiveObject)( column.get(7).getRow() ) ).getShort() , (short)700 );
  assertEquals( ( (PrimitiveObject)( column.get(8).getRow() ) ).getShort() , (short)800 );
  assertEquals( ( (PrimitiveObject)( column.get(9).getRow() ) ).getShort() , (short)900 );
  assertEquals( ( (PrimitiveObject)( column.get(10).getRow() ) ).getShort() , (short)0 );
}
 
Example 3
Source Project: skara   Source File: RepositoryTests.java    License: GNU General Public License v2.0 6 votes vote down vote up
@ParameterizedTest
@EnumSource(VCS.class)
void testTagsOnNonEmptyRepository(VCS vcs) throws IOException {
    try (var dir = new TemporaryDirectory()) {
        var r = Repository.init(dir.path(), vcs);

        var readme = dir.path().resolve("README");
        Files.write(readme, List.of("Hello, readme!"));

        r.add(readme);
        r.commit("Add README", "duke", "[email protected]");

        var expected = vcs == VCS.GIT ? List.of() : List.of(new Tag("tip"));
        assertEquals(expected, r.tags());
    }
}
 
Example 4
Source Project: yosegi   Source File: TestNumberBlockIndex.java    License: Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@MethodSource( "data1" )
public void T_le_3( final IBlockIndex index , final IFilter[] filter ) throws IOException{
  int[] mustReadIndex = { 0 , 1 };
  List<Integer> resultIndexList = index.getBlockSpreadIndex( filter[8] );
  if( resultIndexList == null ){
    assertTrue( true );
    return;
  }
  Set<Integer> dic = new HashSet<Integer>();
  for( Integer i : resultIndexList ){
    dic.add( i );
  }
  for( int i = 0 ; i < mustReadIndex.length ; i++ ){
    assertTrue( dic.contains( mustReadIndex[i] ) );
  }
}
 
Example 5
Source Project: yosegi   Source File: TestCalcLogicalDataSizeDouble.java    License: Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@MethodSource( "data1" )
public void T_notNull_1( final String targetClassName ) throws IOException {
  IColumn column = new PrimitiveColumn( ColumnType.DOUBLE , "column" );
  column.add( ColumnType.DOUBLE , new DoubleObj( (double)1 ) , 0 );
  column.add( ColumnType.DOUBLE , new DoubleObj( (double)2 ) , 1 );
  column.add( ColumnType.DOUBLE , new DoubleObj( (double)3 ) , 2 );
  column.add( ColumnType.DOUBLE , new DoubleObj( (double)4 ) , 3 );
  column.add( ColumnType.DOUBLE , new DoubleObj( (double)5 ) , 4 );
  column.add( ColumnType.DOUBLE , new DoubleObj( (double)6 ) , 5 );
  column.add( ColumnType.DOUBLE , new DoubleObj( (double)7 ) , 6 );
  column.add( ColumnType.DOUBLE , new DoubleObj( (double)8 ) , 7 );
  column.add( ColumnType.DOUBLE , new DoubleObj( (double)9 ) , 8 );
  column.add( ColumnType.DOUBLE , new DoubleObj( (double)10 ) , 9 );

  ColumnBinary columnBinary = create( column , targetClassName );
  assertEquals( columnBinary.logicalDataSize , Double.BYTES * 10 );
}
 
Example 6
Source Project: skara   Source File: RepositoryTests.java    License: GNU General Public License v2.0 6 votes vote down vote up
@ParameterizedTest
@EnumSource(VCS.class)
void testNonCheckedOutRepositoryIsHealthy(VCS vcs) throws IOException {
    try (var dir1 = new TemporaryDirectory();
         var dir2 = new TemporaryDirectory()) {
        var r1 = Repository.init(dir1.path(), vcs);

        var readme = dir1.path().resolve("README");
        Files.write(readme, List.of("Hello, readme!"));

        r1.add(readme);
        var hash = r1.commit("Add README", "duke", "[email protected]");
        r1.tag(hash, "tag", "tagging", "duke", "[email protected]");

        var r2 = Repository.init(dir2.path(), vcs);
        r2.fetch(r1.root().toUri(), r1.defaultBranch().name());

        assertTrue(r2.isHealthy());
    }
}
 
Example 7
Source Project: yosegi   Source File: TestCalcLogicalDataSizeLong.java    License: Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@MethodSource( "data1" )
public void T_notNull_1( final String targetClassName ) throws IOException {
  IColumn column = new PrimitiveColumn( ColumnType.LONG , "column" );
  column.add( ColumnType.LONG , new LongObj( (long)1 ) , 0 );
  column.add( ColumnType.LONG , new LongObj( (long)2 ) , 1 );
  column.add( ColumnType.LONG , new LongObj( (long)3 ) , 2 );
  column.add( ColumnType.LONG , new LongObj( (long)4 ) , 3 );
  column.add( ColumnType.LONG , new LongObj( (long)5 ) , 4 );
  column.add( ColumnType.LONG , new LongObj( (long)6 ) , 5 );
  column.add( ColumnType.LONG , new LongObj( (long)7 ) , 6 );
  column.add( ColumnType.LONG , new LongObj( (long)8 ) , 7 );
  column.add( ColumnType.LONG , new LongObj( (long)9 ) , 8 );
  column.add( ColumnType.LONG , new LongObj( (long)10 ) , 9 );

  ColumnBinary columnBinary = create( column , targetClassName );
  assertEquals( columnBinary.logicalDataSize , Long.BYTES * 10 );
}
 
Example 8
Source Project: skara   Source File: JCheckTests.java    License: GNU General Public License v2.0 6 votes vote down vote up
@ParameterizedTest
@EnumSource(VCS.class)
void checksForCommit(VCS vcs) throws Exception {
    try (var dir = new TemporaryDirectory()) {
        var repoPath = dir.path().resolve("repo");
        var repo = CheckableRepository.create(repoPath, vcs);

        var readme = repoPath.resolve("README");
        Files.write(readme, List.of("Hello, readme!"));
        repo.add(readme);
        var first = repo.commit("Add README", "duke", "[email protected]");

        var censusPath = dir.path().resolve("census");
        Files.createDirectories(censusPath);
        CensusCreator.populateCensusDirectory(censusPath);
        var census = Census.parse(censusPath);

        var checks = JCheck.checksFor(repo, census, first);
        var checkNames = checks.stream()
                               .map(Check::name)
                               .collect(Collectors.toSet());
        assertEquals(Set.of("whitespace", "reviewers"), checkNames);
    }
}
 
Example 9
Source Project: camel-k-runtime   Source File: WebhookTest.java    License: Apache License 2.0 6 votes vote down vote up
@ParameterizedTest()
@EnumSource(WebhookAction.class)
public void testRegistrationFailure(WebhookAction action) throws Exception {
    ApplicationRuntime runtime = new ApplicationRuntime();
    runtime.setProperties(
        "camel.component.webhook.configuration.webhook-auto-register", "false",
        "camel.k.customizer.webhook.enabled", "true",
        "camel.k.customizer.webhook.action", action.name());

    runtime.getCamelContext().addComponent(
        "dummy",
        new DummyWebhookComponent(
        () -> {
            throw new RuntimeException("dummy error");
        },
        () -> {
            throw new RuntimeException("dummy error");
        })
    );

    runtime.addListener(new ContextConfigurer());
    runtime.addListener(RoutesConfigurer.forRoutes("classpath:webhook.js"));

    Assertions.assertThrows(FailedToCreateRouteException.class, runtime::run);
}
 
Example 10
Source Project: chart-fx   Source File: IirFilterTests.java    License: Apache License 2.0 6 votes vote down vote up
@DisplayName("Bessel - High-Pass")
@ParameterizedTest(name = "{displayName}: filter-order: {0}, algorithm: {1}")
@CsvSource({ "2, 0", "3, 0", "4, 0", "2, 1", "3, 1", "4, 1", "2, 2", "3, 2", "4, 2" })
public void testBesselHighPass(final int filterOrder, final int algorithmVariant) {
    final Bessel iirHighPass = new Bessel();
    switch (algorithmVariant) {
    case 1:
        iirHighPass.highPass(filterOrder, 1.0, F_CUT_HIGH, DirectFormAbstract.DIRECT_FORM_I);
        break;
    case 2:
        iirHighPass.highPass(filterOrder, 1.0, F_CUT_HIGH, DirectFormAbstract.DIRECT_FORM_II);
        break;
    case 0:
    default:
        iirHighPass.highPass(filterOrder, 1.0, F_CUT_HIGH);
        break;
    }

    final DataSet magHighPass = filterAndGetMagnitudeSpectrum(iirHighPass, demoDataSet);
    assertThat("high-pass cut-off", magHighPass.getValue(DIM_X, F_CUT_HIGH), lessThan(EPSILON_DB));
    assertThat("high-pass rejection", magHighPass.getValue(DIM_X, 0.1 * F_CUT_HIGH), lessThan(3.0 + EPSILON_DB - 10 * filterOrder));
    assertThat("high-pass pass-band ripple", getRange(magHighPass, (int) (N_SAMPLES_FFT * 0.95), N_SAMPLES_FFT), lessThan(2 * EPSILON_DB));
}
 
Example 11
Source Project: yosegi   Source File: TestNumberBlockIndex.java    License: Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@MethodSource( "data1" )
public void T_lt_2( final IBlockIndex index , final IFilter[] filter ) throws IOException{
  int[] mustReadIndex = { 0 };
  List<Integer> resultIndexList = index.getBlockSpreadIndex( filter[4] );
  if( resultIndexList == null ){
    assertTrue( true );
    return;
  }
  Set<Integer> dic = new HashSet<Integer>();
  for( Integer i : resultIndexList ){
    dic.add( i );
  }
  for( int i = 0 ; i < mustReadIndex.length ; i++ ){
    assertTrue( dic.contains( mustReadIndex[i] ) );
  }
}
 
Example 12
Source Project: yosegi   Source File: TestStringBlockIndex.java    License: Apache License 2.0 6 votes vote down vote up
@ParameterizedTest
@MethodSource( "data1" )
public void T_perfectMatch_3( final IBlockIndex index ) throws IOException{
  int[] mustReadIndex = { 0 , 3 };
  IFilter filter = new PerfectMatchStringFilter( "d" );
  List<Integer> resultIndexList = index.getBlockSpreadIndex( filter );
  if( resultIndexList == null ){
    assertTrue( true );
    return;
  }
  Set<Integer> dic = new HashSet<Integer>();
  for( Integer i : resultIndexList ){
    dic.add( i );
  }
  for( int i = 0 ; i < mustReadIndex.length ; i++ ){
    assertTrue( dic.contains( mustReadIndex[i] ) );
  }
}
 
Example 13
Source Project: clouditor   Source File: EngineAPIResourcesTest.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@ValueSource(
    strings = {"certification", "assets/" + ASSET_TYPE, "accounts", "discovery", "rules"})
void testGetNotAuthenticated(String endpoint) {
  var response = target(endpoint).request().get();

  LOGGER.debug("Endpoint {} returned response code {}", endpoint, response.getStatus());

  assertEquals(401, response.getStatus());
}
 
Example 14
Source Project: camel-quarkus   Source File: HttpTest.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@ValueSource(strings = { "ahc",
        "http", "netty-http" })
public void httpsProducer(String component) {
    RestAssured
            .given()
            .when()
            .get("/test/client/{component}/get-https", component)
            .then()
            .body(containsString("Czech Republic"));
}
 
Example 15
Source Project: vividus   Source File: ScreenshotShootingStrategyTests.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@MethodSource("data")
void test(ScreenshotShootingStrategy strategy, Class<? extends ShootingStrategy> clazz,
    boolean viewportScreenshots, boolean isLandscape, String deviceName)
{
    assertThat(strategy.getDecoratedShootingStrategy(new SimpleShootingStrategy(), viewportScreenshots,
            isLandscape, deviceName), instanceOf(clazz));
}
 
Example 16
Source Project: smithy   Source File: ShapeIdTest.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@MethodSource("shapeIdData")
public void ShapeIdValidationsTest(String shapeId, boolean isInvalid) {
    try {
        ShapeId id = ShapeId.from(shapeId);
        if (isInvalid) {
            Assertions.fail("Expected ShapeIdSyntaxException for but nothing was raised! " + id);
        }
    } catch (ShapeIdSyntaxException ex) {
        if (!isInvalid) {
            Assertions.fail(String.format("Received unexpected validation error: %s", ex.getMessage()));
        }
    }
}
 
Example 17
Source Project: chart-fx   Source File: DoubleFFT1DTests.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@CsvSource({ "1, true", "1, false", "2, true", "2, false", "3, true", "3, false", "4, true", "4, false", "5, true",
        "5, false", "6, true", "6, false", "1023, true", "1023, false", "1024, true", "1024, false", "1025, true",
        "1025, false", "66000, true", "66000, false" })
public void
identityFullRealFFTTests(final int nSamples, final boolean forward) {
    DoubleFFT_1D fft = new DoubleFFT_1D(nSamples);

    double[] testSignal1a = generateDelta(2 * nSamples);
    double[] testSignal1b = new double[2 * nSamples];
    double[] testSignal2a = generateRamp(2 * nSamples, nSamples);
    double[] testSignal2b = new double[2 * nSamples];

    for (int i = 0; i < nSamples; i++) {
        testSignal1b[2 * i] = testSignal1a[i];
        testSignal2b[2 * i] = testSignal2a[i];
    }

    // basic identity tests
    if (forward) {
        fft.realForwardFull(testSignal1a);
        fft.complexForward(testSignal1b);
    } else {
        fft.realInverseFull(testSignal1a, true);
        fft.complexInverse(testSignal1b, true);
    }
    assertArrayEquals(testSignal1a, testSignal1b, nSamples * FFT_NUMERIC_LIMITS,
            "full real vs complex forward delta");

    if (forward) {
        fft.realForwardFull(testSignal2a);
        fft.complexForward(testSignal2b);
    } else {
        fft.realInverseFull(testSignal2a, true);
        fft.complexInverse(testSignal2b, true);
    }
    assertArrayEquals(testSignal2a, testSignal2b, (nSamples < 2000 ? 1.0f : 10f) * nSamples * FFT_NUMERIC_LIMITS,
            "full real vs complex forward ramp");
}
 
Example 18
Source Project: vividus   Source File: CookieStoreLevelEditorTests.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@CsvSource({
        "''",
        "' '"
})
void shouldSetNullValueForBlankText(String value)
{
    CookieStoreLevelEditor cookieStoreLevelEditor = new CookieStoreLevelEditor();
    cookieStoreLevelEditor.setAsText(value);
    assertNull(cookieStoreLevelEditor.getValue());
}
 
Example 19
Source Project: skara   Source File: RepositoryTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@ParameterizedTest
@EnumSource(VCS.class)
void testRangeExclusive(VCS vcs) throws IOException {
    try (var dir = new TemporaryDirectory()) {
        var repo = Repository.init(dir.path(), vcs);
        var range = repo.rangeExclusive(new Hash("01234"), new Hash("56789"));
        if (vcs == VCS.GIT) {
            assertEquals("01234..56789", range);
        } else if (vcs == VCS.HG) {
            assertEquals("01234:56789-01234", range);
        } else {
            fail("Unexpected vcs: " + vcs);
        }
    }
}
 
Example 20
Source Project: yosegi   Source File: TestBooleanCellIndex.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@MethodSource( "data1" )
public void T_match_2( final IColumn column ) throws IOException{
  int[] mustReadIndex = { 1 , 3 , 5 , 7 , 9 , 21 , 23 , 25 , 27 , 29 };
  IFilter filter = new BooleanFilter( false );
  boolean[] filterResult = new boolean[30];
  filterResult = column.filter( filter , filterResult );
  if( filterResult == null ){
    assertTrue( true );
    return;
  }
  for( int i = 0 ; i < mustReadIndex.length ; i++ ){
    assertTrue( filterResult[mustReadIndex[i]] );
  }
}
 
Example 21
Source Project: yosegi   Source File: TestIntegerPrimitiveColumn.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@MethodSource( "data1" )
public void T_hasNull_1( final String targetClassName ) throws IOException{
  IColumn column = createHasNullColumn( targetClassName );
  assertEquals( ( (PrimitiveObject)( column.get(0).getRow() ) ).getInt() , (int)0 );
  assertNull( column.get(1).getRow() );
  assertNull( column.get(2).getRow() );
  assertNull( column.get(3).getRow() );
  assertEquals( ( (PrimitiveObject)( column.get(4).getRow() ) ).getInt() , (int)4 );
  assertNull( column.get(5).getRow() );
  assertNull( column.get(6).getRow() );
  assertNull( column.get(7).getRow() );
  assertEquals( ( (PrimitiveObject)( column.get(8).getRow() ) ).getInt() , (int)8 );
}
 
Example 22
Source Project: skara   Source File: RepositoryTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@ParameterizedTest
@EnumSource(VCS.class)
void testExistsOnMissingDirectory(VCS vcs) throws IOException {
    var d = Paths.get("/", "this", "path", "does", "not", "exist");
    var r = Repository.get(d);
    assertTrue(r.isEmpty());
}
 
Example 23
Source Project: jstarcraft-nlp   Source File: DetectionTestCase.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 测试装载语种检测规则
 * 
 * @param path
 * @param size
 */
@ParameterizedTest
@CsvSource({ "regulation-82.json,20", "regulation-187.json,30", "regulation-406.json,37" })
public void testLoadPattern(String path, int size) {
    try (InputStream stream = DetectionPattern.class.getResourceAsStream(path)) {
        Map<String, DetectionPattern> regulations = DetectionPattern.loadPatterns(stream);
        Assertions.assertEquals(size, regulations.size());
    } catch (Exception exception) {
        throw new IllegalArgumentException(exception);
    }
}
 
Example 24
Source Project: vividus   Source File: CodeStepsTests.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@CsvSource({
    ",       body",
    "OBJECT,     "
})
void testExecuteJavascriptWithArgumentsNoType(JsArgumentType type, String value)
{
    JsArgument argument = createJsArgument(type, value);
    IllegalArgumentException exception = assertThrows(IllegalArgumentException.class,
        () -> codeSteps.executeJavascriptWithArguments("document.querySelector(arguments[0])",
                Collections.singletonList(argument)));
    assertEquals(JS_ARGUMENT_ERROR_MESSAGE, exception.getMessage());
}
 
Example 25
Source Project: yosegi   Source File: TestRangeStringIndex.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@MethodSource( "data1" )
public void T_filter_1( final ICellIndex cIndex , final IFilter filter , final boolean[] result ) throws IOException{
  boolean[] r = cIndex.filter( filter , new boolean[0] );
  if( r == null ){
    assertNull( result );
  }
  else{
    assertEquals( result.length , 0 );
  }
}
 
Example 26
Source Project: vividus   Source File: RequestPartTypeTests.java    License: Apache License 2.0 5 votes vote down vote up
@MethodSource("stringContentTypes")
@ParameterizedTest
void testAddStringPart(Optional<String> contentTypeAsString, ContentType contentType)
        throws IOException
{
    MultipartEntityBuilder builder = MultipartEntityBuilder.create();
    String name = "stringKey";
    String value = "stringValue";
    RequestPartType.STRING.addPart(builder, name, value, contentTypeAsString);
    assertHttpEntity(builder, buildExpectedEntity(name, contentType, "8bit", value));
}
 
Example 27
Source Project: milkman   Source File: StringUtilsTest.java    License: MIT License 5 votes vote down vote up
@ParameterizedTest
@CsvSource({
        "test, true",
        "tt, true",
        "ttt, false",
        "es, true",
        "se, false",
        ", true"
})
public void test(String value, boolean expected){
    assertThat(StringUtils.containsLettersInOrder("test", value)).isEqualTo(expected);
}
 
Example 28
Source Project: chart-fx   Source File: IirFilterTests.java    License: Apache License 2.0 5 votes vote down vote up
@DisplayName("Bessel - Band-Stop")
@ParameterizedTest(name = "{displayName}: filter-order: {0}, algorithm: {1}")
@CsvSource({ "2, 0", "3, 0", "4, 0", "2, 1", "3, 1", "4, 1", "2, 2", "3, 2", "4, 2" })
public void testBesselBandStop(final int filterOrder, final int algorithmVariant) {
    final Bessel iirBandStop = new Bessel();
    switch (algorithmVariant) {
    case 1:
        iirBandStop.bandStop(filterOrder, 1.0, F_BAND_CENTRE, F_BAND_WIDTH, DirectFormAbstract.DIRECT_FORM_I);
        break;
    case 2:
        iirBandStop.bandStop(filterOrder, 1.0, F_BAND_CENTRE, F_BAND_WIDTH, DirectFormAbstract.DIRECT_FORM_II);
        break;
    case 0:
    default:
        iirBandStop.bandStop(filterOrder, 1.0, F_BAND_CENTRE, F_BAND_WIDTH);
        break;
    }

    final DataSet magBandStop = filterAndGetMagnitudeSpectrum(iirBandStop, demoDataSet);
    assertThat("band-stop cut-off (low)", magBandStop.getValue(DIM_X, F_BAND_START), lessThan(EPSILON_DB));
    assertThat("band-stop cut-off (high)", magBandStop.getValue(DIM_X, F_BAND_STOP), lessThan(EPSILON_DB));
    assertThat("band-pass pass-band (low)", getRange(magBandStop, 0, magBandStop.getIndex(DIM_X, F_BAND_START * 0.1)), lessThan(EPSILON_DB));
    assertThat("band-pass pass-band (high)", getRange(magBandStop, (int) (N_SAMPLES_FFT * 0.95), N_SAMPLES_FFT), lessThan(EPSILON_DB));
    final double rangeStopBand = getMaximum(magBandStop,
            magBandStop.getIndex(DIM_X, (F_BAND_CENTRE - 0.03 * F_BAND_WIDTH)),
            magBandStop.getIndex(DIM_X, (F_BAND_CENTRE + 0.03 * F_BAND_WIDTH)));
    assertThat("band-pass stop-band ripple", rangeStopBand, lessThan(3.0 + EPSILON_DB - 10 * filterOrder));
}
 
Example 29
Source Project: hedera-mirror-node   Source File: TimestampConverterTest.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest(name = "toInstantByRegexPositive({0},{1},{2},{3})")
@MethodSource("toInstantByRegexPositiveSource")
public void toInstantByRegexPositive(long expectedSeconds, long expectedNanos, String pattern,
                                     String value) {
    var cut = getCut();
    var p = Pattern.compile(pattern);
    var m = p.matcher(value);
    assertTrue(m.find());
    var inst = cut.toInstant(m);
    assertAll(() -> assertEquals(expectedSeconds, inst.getEpochSecond()),
            () -> assertEquals(expectedNanos, inst.getNano())
    );
}
 
Example 30
Source Project: pg-index-health   Source File: DatabaseHealthImplTest.java    License: Apache License 2.0 5 votes vote down vote up
@ParameterizedTest
@ValueSource(strings = {"public", "custom"})
void getDuplicatedIndexesWithDifferentCollationShouldReturnNothing(final String schemaName) {
    executeTestOnDatabase(schemaName,
            dbp -> dbp.withReferences().withCustomCollation().withDuplicatedCustomCollationIndex(),
            ctx -> {
                final List<DuplicatedIndexes> duplicatedIndexes = databaseHealth.getDuplicatedIndexes(ctx);
                assertNotNull(duplicatedIndexes);
                assertThat(duplicatedIndexes, empty());
            });
}