@Test
public void squareWaveTest() {

	double[] data = testDataGenerator.createSquareWaveData();
	SeasonalTrendLoess.Builder builder = new SeasonalTrendLoess.Builder().setPeriodLength(288).setSeasonalWidth(13).setNonRobust();
	SeasonalTrendLoess smoother = builder.buildSmoother(data);
	SeasonalTrendLoess.Decomposition stl = smoother.decompose();
	double[] trend = stl.getTrend();
	double[] seasonal = stl.getSeasonal();
	double[] residuals = stl.getResidual();
	double[] weights = stl.getWeights();
	for (int i = 0; i < data.length; ++i) {
		assertEquals(42.5, trend[i], 1.0e-12);
		assertEquals(data[i], seasonal[i] + stl.getTrend()[i], 1.0e-12);
		assertEquals(0.0, residuals[i], 1.0e-12);
		assertEquals(1.0, weights[i], 1.0e-13);
	}
}