Update of /cvsroot/tail/Tail/src/test/net/sf/tail/runner
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13475/src/test/net/sf/tail/runner
Modified Files:
HistoryRunnerTest.java ShortSellRunnerTest.java
Log Message:
Index: HistoryRunnerTest.java
===================================================================
RCS file: /cvsroot/tail/Tail/src/test/net/sf/tail/runner/HistoryRunnerTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** HistoryRunnerTest.java 13 Aug 2007 21:45:16 -0000 1.12
--- HistoryRunnerTest.java 23 Aug 2007 12:51:11 -0000 1.13
***************
*** 24,46 ****
@Before
public void setUp() {
! enter = new Operation[] { null,
! null,
! new Operation(2, OperationType.BUY),
! new Operation(3, OperationType.BUY),
! null,
! null,
! new Operation(6, OperationType.BUY),
! null,
! null
! };
! exit = new Operation[] { null,
! null,
! null,
! null,
! new Operation(4, OperationType.SELL),
! null,
! null,
! new Operation(7, OperationType.SELL),
! new Operation(8, OperationType.SELL) };
strategy = new FakeStrategy(enter, exit);
}
--- 24,31 ----
@Before
public void setUp() {
! enter = new Operation[] { null, null, new Operation(2, OperationType.BUY), new Operation(3, OperationType.BUY),
! null, null, new Operation(6, OperationType.BUY), null, null };
! exit = new Operation[] { null, null, null, null, new Operation(4, OperationType.SELL), null, null,
! new Operation(7, OperationType.SELL), new Operation(8, OperationType.SELL) };
strategy = new FakeStrategy(enter, exit);
}
***************
*** 87,122 ****
}
! @Test public void
! testDoesntRunOnEmptyInterval() {
HistoryRunner runner = new HistoryRunner(OperationType.BUY);
!
List<Trade> trades = runner.run(this.strategy, 0, 0);
!
assertEquals(0, trades.size());
}
@Test(expected = IndexOutOfBoundsException.class)
! public void
! testDoesntRunOnInvalidIntervalNegativeStart() {
HistoryRunner runner = new HistoryRunner(OperationType.BUY);
!
@SuppressWarnings("unused")
List<Trade> trades = runner.run(this.strategy, -1, 0);
}
! @Test (expected = IndexOutOfBoundsException.class)
! public void
! testDoesntRunOnInvalidIntervalNegativeEnd() {
HistoryRunner runner = new HistoryRunner(OperationType.BUY);
!
@SuppressWarnings("unused")
List<Trade> trades = runner.run(this.strategy, 0, -1);
}
! @Test (expected = IllegalArgumentException.class)
! public void
! testDoesntRunOnInvalidIntervalEndBeforeStarting() {
HistoryRunner runner = new HistoryRunner(OperationType.BUY);
!
@SuppressWarnings("unused")
List<Trade> trades = runner.run(this.strategy, 3, 2);
--- 72,104 ----
}
! @Test
! public void testDoesntRunOnEmptyInterval() {
HistoryRunner runner = new HistoryRunner(OperationType.BUY);
!
List<Trade> trades = runner.run(this.strategy, 0, 0);
!
assertEquals(0, trades.size());
}
@Test(expected = IndexOutOfBoundsException.class)
! public void testDoesntRunOnInvalidIntervalNegativeStart() {
HistoryRunner runner = new HistoryRunner(OperationType.BUY);
!
@SuppressWarnings("unused")
List<Trade> trades = runner.run(this.strategy, -1, 0);
}
! @Test(expected = IndexOutOfBoundsException.class)
! public void testDoesntRunOnInvalidIntervalNegativeEnd() {
HistoryRunner runner = new HistoryRunner(OperationType.BUY);
!
@SuppressWarnings("unused")
List<Trade> trades = runner.run(this.strategy, 0, -1);
}
! @Test(expected = IllegalArgumentException.class)
! public void testDoesntRunOnInvalidIntervalEndBeforeStarting() {
HistoryRunner runner = new HistoryRunner(OperationType.BUY);
!
@SuppressWarnings("unused")
List<Trade> trades = runner.run(this.strategy, 3, 2);
***************
*** 124,146 ****
@Test(expected = NullPointerException.class)
! public void
! testNullTypeShouldThrowException() {
@SuppressWarnings("unused")
HistoryRunner runner = new HistoryRunner(null);
}
!
! @Test
! public void
! testRunSplitted() {
HistoryRunner historyRunner = new HistoryRunner(OperationType.BUY);
List<Trade> trades = historyRunner.run(this.strategy, 0, 3);
assertEquals(1, trades.size());
!
trades = historyRunner.run(this.strategy, 3, 6);
!
assertEquals(2, trades.size());
assertEquals(new Operation(3, OperationType.BUY), trades.get(0).getEntry());
assertEquals(new Operation(4, OperationType.SELL), trades.get(0).getExit());
!
trades = historyRunner.run(this.strategy, 6, 8);
--- 106,126 ----
@Test(expected = NullPointerException.class)
! public void testNullTypeShouldThrowException() {
@SuppressWarnings("unused")
HistoryRunner runner = new HistoryRunner(null);
}
!
! @Test
! public void testRunSplitted() {
HistoryRunner historyRunner = new HistoryRunner(OperationType.BUY);
List<Trade> trades = historyRunner.run(this.strategy, 0, 3);
assertEquals(1, trades.size());
!
trades = historyRunner.run(this.strategy, 3, 6);
!
assertEquals(2, trades.size());
assertEquals(new Operation(3, OperationType.BUY), trades.get(0).getEntry());
assertEquals(new Operation(4, OperationType.SELL), trades.get(0).getExit());
!
trades = historyRunner.run(this.strategy, 6, 8);
Index: ShortSellRunnerTest.java
===================================================================
RCS file: /cvsroot/tail/Tail/src/test/net/sf/tail/runner/ShortSellRunnerTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ShortSellRunnerTest.java 16 Aug 2007 03:31:01 -0000 1.2
--- ShortSellRunnerTest.java 23 Aug 2007 12:51:11 -0000 1.3
***************
*** 62,66 ****
}
-
@Test
public void testRunWithNoTrades() {
--- 62,65 ----
***************
*** 74,77 ****
}
-
}
--- 73,75 ----
|