The only test I ran was to ensure that the results you get from main() are identical to the unmodified version. I'm reasonably certain that the behavior is identical to the original - which means whatever problems were in the original are still there. I just made it (I hope) a little easier to understand, and therefore, I hope, easier to fix. I didn't have time to look at it for the bug, but I hope that without the duplication, the bug will be easier to spot. If I get a chance, I'll try to look at it, but I haven't had a chance yet. My first step in tracking down bugs is often to clean up the code, because I really have trouble making sense of the code otherwise - and without the understanding that comes from that, it's really hard (for me, at least) to figure out what's wrong.clam61 wrote:awesome...but does it work now?!
did you ever find out the problem with it?
Here, by the way, is my test class; I recommend JUnit (and, for that matter, test-driven development):
Code: Select all
import java.util.TimeZone;
import junit.framework.TestCase;
public class IntradayMarketTimelineTest extends TestCase {
private IntradayMarketTimeline timeline;
protected void setUp() throws Exception {
TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
timeline = new IntradayMarketTimeline(0L, 0L, 34200000L, 57600000L, 34200000L, 57600000L, 34200000L, 57600000L, 34200000L, 57600000L, 34200000L,
57600000L, 0L, 0L);
}
public void testTimeline() throws Exception {
assertEquals(730080000, IntradayMarketTimeline.MILLIS_PER_DAY + IntradayMarketTimeline.MILLIS_PER_WEEK + 38880000L);
assertEquals(145080000, timeline.toTimelineValue(IntradayMarketTimeline.MILLIS_PER_DAY + IntradayMarketTimeline.MILLIS_PER_WEEK + 38880000L));
assertEquals(730080000, timeline.toMillisecond(145080000L));
}
}
--Carl