@Test
    public void testCalcIncrementCalc() {
      	DoublesArray arr = new DoublesArray();
    	int avglen = 10;
      	int samples = 12;
    	for(int i=0; i<samples; i++) {
    		arr.add((double)i*2);
    	}
      	Doubles sma = DoublesFunctions.sma(arr, avglen);

	    assertEquals("cache.size == 0 on init", sma.size(), 0);
      	
    	for(int i=avglen; i<samples; i++) {
    		double sum = 0.0;
    		for(int j=0; j<avglen; j++) {
    			sum += arr.get(i-j);
    		}
    		double avg = sum / (double)avglen;
    		assertEquals("entry i" + i, sma.get(i), new Double(avg));
    		if (VERBOSE) System.out.println(i + ": " + arr.get(i) + " --> " + avg + " --> " + sma.get(i));
    	}

    	
    	int newsamples = 20;
    	for(int i=samples; i<newsamples; i++) {
    		arr.add((double)i*2);
    	}
    	if (VERBOSE) System.out.println();
    	
    	for(int i=avglen; i<newsamples; i++) {
    		double sum = 0.0;
    		for(int j=0; j<avglen; j++) {
    			sum += arr.get(i-j);
    		}
    		double avg = sum / (double)avglen;
    		assertEquals("entry i" + i, sma.get(i), new Double(avg));
    		if (VERBOSE) System.out.println(i + ": " + arr.get(i) + " --> " + avg + " --> " + sma.get(i));
    	}

    }