Update of /cvsroot/tail/Tail/src/test/net/sf/tail/indicator
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv31643/src/test/net/sf/tail/indicator
Modified Files:
SMAIndicatorTest.java EMAIndicatorTest.java
Log Message:
Continuando a readaptar as classes
Index: SMAIndicatorTest.java
===================================================================
RCS file: /cvsroot/tail/Tail/src/test/net/sf/tail/indicator/SMAIndicatorTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SMAIndicatorTest.java 12 May 2007 14:23:35 -0000 1.3
--- SMAIndicatorTest.java 12 May 2007 17:34:01 -0000 1.4
***************
*** 2,5 ****
--- 2,7 ----
+ import java.util.Arrays;
+
import net.sf.tail.SampleTimeSeries;
import net.sf.tail.TimeSeries;
***************
*** 48,51 ****
--- 50,62 ----
}
+ @Test
+ public void testIncreaseArrayMethod() {
+ double[] d = new double[200];
+ Arrays.fill(d, 10);
+ TimeSeries dataMax = new SampleTimeSeries(d );
+ SMAIndicator quoteSMA = new SMAIndicator(new ClosePriceIndicator(dataMax), 100);
+ assertEquals(10d, quoteSMA.getValue(105));
+ }
+
@Test(expected = IndexOutOfBoundsException.class)
public void testWrongIndex() {
Index: EMAIndicatorTest.java
===================================================================
RCS file: /cvsroot/tail/Tail/src/test/net/sf/tail/indicator/EMAIndicatorTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** EMAIndicatorTest.java 12 May 2007 14:23:35 -0000 1.3
--- EMAIndicatorTest.java 12 May 2007 17:34:01 -0000 1.4
***************
*** 7,10 ****
--- 7,11 ----
import net.sf.tail.indicator.tracker.SMAIndicator;
+ import org.junit.Before;
import org.junit.Test;
***************
*** 17,23 ****
private TimeSeries data;
public void setUp() {
//data = new SampleData(new double[] { 447.3, 456.8, 451.0, 452.5, 453.4, 455.5, 456.0, 454.7, 453.5, 456.5,
! // 459.5, 465.2, 460.8, 460.8 });
data = new SampleTimeSeries(new double[] { 64.75, 63.79, 63.73, 63.73, 63.55, 63.19, 63.91, 63.85, 62.95, 63.37,
61.33, 61.51 });
--- 18,25 ----
private TimeSeries data;
+ @Before
public void setUp() {
//data = new SampleData(new double[] { 447.3, 456.8, 451.0, 452.5, 453.4, 455.5, 456.0, 454.7, 453.5, 456.5,
! // 459.5, 465.2, 460.8, 460.8 });
data = new SampleTimeSeries(new double[] { 64.75, 63.79, 63.73, 63.73, 63.55, 63.19, 63.91, 63.85, 62.95, 63.37,
61.33, 61.51 });
***************
*** 31,34 ****
--- 33,38 ----
// the start of an EMA must be equals to a SMA
for (int i = 0; i < 9; i++) {
+ sma.getValue(i);
+ ema.getValue(i);
assertEquals(sma.getValue(i), ema.getValue(i));
}
***************
*** 49,57 ****
assertEquals(3d, ema.getValue(14));
}
!
// Método adicionado por causa da compatibilidade do Eclipse 3.1.2(Rede Linux)
//e o JUnit4
public static junit.framework.Test suite() {
! return new JUnit4TestAdapter(EMAIndicatorTest.class);
}
}
--- 53,61 ----
assertEquals(3d, ema.getValue(14));
}
!
// Método adicionado por causa da compatibilidade do Eclipse 3.1.2(Rede Linux)
//e o JUnit4
public static junit.framework.Test suite() {
! return new JUnit4TestAdapter(EMAIndicatorTest.class);
}
}
|