This commit is contained in:
Will Charczuk 2017-05-16 19:16:26 -07:00
parent 04a4edcb46
commit 5cf4f5f0d7
4 changed files with 8 additions and 4 deletions

View file

@ -118,7 +118,7 @@ func (bc Box2d) Overlaps(other Box2d) bool {
}
func (bc Box2d) String() string {
return fmt.Sprintf("BoxC{%s,%s,%s,%s}", bc.TopLeft.String(), bc.TopRight.String(), bc.BottomRight.String(), bc.BottomLeft.String())
return fmt.Sprintf("Box2d{%s,%s,%s,%s}", bc.TopLeft.String(), bc.TopRight.String(), bc.BottomRight.String(), bc.BottomLeft.String())
}
// Point is an X,Y pair

View file

@ -61,6 +61,6 @@ func TestBox2dOverlaps(t *testing.T) {
assert.True(bc.Overlaps(bc5))
bcr := bc.Rotate(45)
bcr2 := bc.Rotate(45).Shift(bc.Height(), 0)
assert.False(bcr.Overlaps(bcr2), fmt.Sprintf("%v\n\t\tshould not overlap\n\t%v", bcr, bcr2))
bcr2 := bc.Rotate(45).Shift(bc.Width()/2.0, 0)
assert.True(bcr.Overlaps(bcr2), fmt.Sprintf("%v\n\t\tshould overlap\n\t%v", bcr, bcr2))
}

View file

@ -78,6 +78,10 @@ func (cs CandlestickSeries) GetCandleValues() []CandleValue {
// GenerateCandleValues returns the candlestick values for each day represented by the inner series.
func (cs CandlestickSeries) GenerateCandleValues() []CandleValue {
if cs.InnerSeries == nil {
return nil
}
totalValues := cs.InnerSeries.Len()
if totalValues == 0 {
return nil
@ -105,7 +109,7 @@ func (cs CandlestickSeries) GenerateCandleValues() []CandleValue {
lv = v
for i := 1; i < totalValues; i++ {
tv, v = cs.InnerSeries.GetValues(0)
tv, v = cs.InnerSeries.GetValues(i)
t = util.Time.FromFloat64(tv)
year, month, day = t.Year(), int(t.Month()), t.Day()

BIN
debug.test Executable file

Binary file not shown.