@Test public void logTrendLine_simpleTest() { // :: Setup Forecast.LogTrendLine trendLine = new Forecast.LogTrendLine(); // Data set first large increase, then less and less increasing values. trendLine.setValues(new double[]{1, 16, 26, 31}, new double[]{1, 2, 3, 4}); // :: Act double errorVarience = trendLine.errorVarience(); double prediction = trendLine.predict(5); // :: Verify Truth.assertThat(prediction) .isWithin(0.01) .of(36.41); Truth.assertThat(errorVarience) .isWithin(0.01) .of(0.5); } }
@Test public void logTrendLine_simpleTest() { // :: Setup Forecast.LogTrendLine trendLine = new Forecast.LogTrendLine(); // Data set first large increase, then less and less increasing values. trendLine.setValues(new double[]{1, 16, 26, 31}, new double[]{1, 2, 3, 4}); // :: Act double errorVarience = trendLine.errorVarience(); double prediction = trendLine.predict(5); // :: Verify Truth.assertThat(prediction) .isWithin(0.01) .of(36.41); Truth.assertThat(errorVarience) .isWithin(0.01) .of(0.5); } }