コード例 #1
0
 @Test
 public void testMin() {
   double arr[] = {-1.5, 0, 2.5, 100, -50.2};
   TemperatureSeriesAnalysis temperatureSeriesAnalysis = new TemperatureSeriesAnalysis(arr);
   double expected = -50.2;
   double actual = temperatureSeriesAnalysis.min();
   assertEquals(expected, actual, 0.0001);
 }
コード例 #2
0
  @Test
  public void testMinArrayWithDifferentElements() {
    double[] temperatureSeries = {51.2036, -23, 12.23, 5.024, -44, 32.02, -44.0003, -20, 52, 1.235};
    TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries);
    double expResult = -44.0003;
    double actualResult = seriesAnalysis.min();

    assertEquals(expResult, actualResult, epsilon);
  }
コード例 #3
0
  @Test
  public void testMinArrayWithPositiveElements() {
    double[] temperatureSeries = {51.2036, 23, 12.23, 5.024, 44};
    TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries);
    double expResult = 5.024;
    double actualResult = seriesAnalysis.min();

    assertEquals(expResult, actualResult, epsilon);
  }
コード例 #4
0
  @Test
  public void testMinArrayWithSigleElement() {
    double[] temperatureSeries = {-51.2036};
    TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries);
    double expResult = -51.2036;
    double actualResult = seriesAnalysis.min();

    assertEquals(expResult, actualResult, epsilon);
  }
コード例 #5
0
 @Test(expected = IllegalArgumentException.class)
 public void testMin_FailOnEmptyList() {
   double arr[] = {};
   TemperatureSeriesAnalysis temperatureSeriesAnalysis = new TemperatureSeriesAnalysis(arr);
   temperatureSeriesAnalysis.min();
 }
コード例 #6
0
 @Test(expected = IllegalArgumentException.class)
 public void testMinFailOnEmptyArray() {
   double[] temperatureSeries = {};
   TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries);
   seriesAnalysis.min();
 }