コード例 #1
0
 @Test
 public void testMax() {
   double arr[] = {-1.5, 0, 2.5, 100, -50.2};
   TemperatureSeriesAnalysis temperatureSeriesAnalysis = new TemperatureSeriesAnalysis(arr);
   double expected = 100;
   double actual = temperatureSeriesAnalysis.max();
   assertEquals(expected, actual, 0.0001);
 }
コード例 #2
0
  @Test
  public void testMaxArrayWithPositiveElements() {
    double[] temperatureSeries = {31.3916, 123, 12.23, 5.24, 44.02};
    TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries);
    double expResult = 123;
    double actualResult = seriesAnalysis.max();

    assertEquals(expResult, actualResult, epsilon);
  }
コード例 #3
0
  @Test
  public void testMaxArrayWithSigleElement() {
    double[] temperatureSeries = {31.3916};
    TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries);
    double expResult = 31.3916;
    double actualResult = seriesAnalysis.max();

    assertEquals(expResult, actualResult, epsilon);
  }
コード例 #4
0
  @Test
  public void testMaxArrayWithDifferentElements() {
    double[] temperatureSeries = {
      51.2036, -23, 12.23, 5.024, -44, 32.02, -44.0003, -20, 52.1456, 1.235
    };
    TemperatureSeriesAnalysis seriesAnalysis = new TemperatureSeriesAnalysis(temperatureSeries);
    double expResult = 52.1456;
    double actualResult = seriesAnalysis.max();

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