Update of /cvsroot/tail/Tail/src/test/net/sf/tail/runner
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1640/src/test/net/sf/tail/runner
Modified Files:
HistoryRunnerTest.java
Log Message:
Incio da refatorao para usar Strategy.shouldOperate()
Index: HistoryRunnerTest.java
===================================================================
RCS file: /cvsroot/tail/Tail/src/test/net/sf/tail/runner/HistoryRunnerTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** HistoryRunnerTest.java 19 May 2007 19:59:31 -0000 1.5
--- HistoryRunnerTest.java 6 Jun 2007 19:24:53 -0000 1.6
***************
*** 9,13 ****
import net.sf.tail.Strategy;
import net.sf.tail.Trade;
! import net.sf.tail.strategy.FakeStratetgy;
import org.junit.Test;
--- 9,13 ----
import net.sf.tail.Strategy;
import net.sf.tail.Trade;
! import net.sf.tail.strategy.FakeStrategy;
import org.junit.Test;
***************
*** 15,27 ****
public class HistoryRunnerTest {
! @Test
! public void testRunMethod() {
Operation[] enter = { null, null, new Operation(2, OperationType.BUY),
! new Operation(3, OperationType.BUY), null, null, new Operation(6, OperationType.BUY), null };
Operation[] exit = { null, null, null, null, new Operation(4, OperationType.SELL),
null, null, new Operation(7, OperationType.SELL), new Operation(8, OperationType.SELL) };
! Strategy strategy = new FakeStratetgy(enter, exit);
! HistoryRunner historyRunner = new HistoryRunner(8);
List<Trade> trades = historyRunner.run(strategy);
assertEquals(2, trades.size());
--- 15,27 ----
public class HistoryRunnerTest {
! @Test public void
! testRunMethod() {
Operation[] enter = { null, null, new Operation(2, OperationType.BUY),
! new Operation(3, OperationType.BUY), null, null, new Operation(6, OperationType.BUY), null, null };
Operation[] exit = { null, null, null, null, new Operation(4, OperationType.SELL),
null, null, new Operation(7, OperationType.SELL), new Operation(8, OperationType.SELL) };
! Strategy strategy = new FakeStrategy(enter, exit);
! HistoryRunner historyRunner = new HistoryRunner(8, OperationType.BUY);
List<Trade> trades = historyRunner.run(strategy);
assertEquals(2, trades.size());
***************
*** 35,46 ****
}
! @Test
! public void testRunWithOpenEntryBuyLeft() {
Operation[] enter = new Operation[] { null, new Operation(1, OperationType.BUY),
null, null };
Operation[] exit = {null, null, null,null};
! Strategy strategy = new FakeStratetgy(enter, exit);
! HistoryRunner historyRunner = new HistoryRunner(4);
List<Trade> trades = historyRunner.run(strategy);
assertEquals(1, trades.size());
--- 35,46 ----
}
! @Test public void
! testRunWithOpenEntryBuyLeft() {
Operation[] enter = new Operation[] { null, new Operation(1, OperationType.BUY),
null, null };
Operation[] exit = {null, null, null,null};
! Strategy strategy = new FakeStrategy(enter, exit);
! HistoryRunner historyRunner = new HistoryRunner(4, OperationType.BUY);
List<Trade> trades = historyRunner.run(strategy);
assertEquals(1, trades.size());
***************
*** 51,62 ****
! @Test
! public void testRunWithOpenEntrySellLeft() {
Operation[] enter = new Operation[] { null, new Operation(1, OperationType.SELL),
null, null };
Operation[] exit = {null, null, null,null};
! Strategy strategy = new FakeStratetgy(enter, exit);
! HistoryRunner historyRunner = new HistoryRunner(4);
List<Trade> trades = historyRunner.run(strategy);
assertEquals(1, trades.size());
--- 51,62 ----
! @Test public void
! testRunWithOpenEntrySellLeft() {
Operation[] enter = new Operation[] { null, new Operation(1, OperationType.SELL),
null, null };
Operation[] exit = {null, null, null,null};
! Strategy strategy = new FakeStrategy(enter, exit);
! HistoryRunner historyRunner = new HistoryRunner(4, OperationType.SELL);
List<Trade> trades = historyRunner.run(strategy);
assertEquals(1, trades.size());
|