Fixed order of arguments to assert.Len in test files. (#93)

* Fixed order of arguments to assert.Len in test files.

* Added BaseValue funtionality to bar chart
This commit is contained in:
David Mis 2018-09-05 10:45:19 -05:00 committed by Will Charczuk
parent 3edccc4758
commit ac680bd82d
15 changed files with 29 additions and 29 deletions

View File

@ -242,7 +242,7 @@ func TestBarChartGetAxesTicks(t *testing.T) {
bc.YAxis.Style.Show = true
ticks = bc.getAxesTicks(r, yr, yf)
assert.Len(2, ticks)
assert.Len(ticks, 2)
}
func TestBarChartCalculateEffectiveBarSpacing(t *testing.T) {

View File

@ -17,7 +17,7 @@ func TestGenerateGridLines(t *testing.T) {
}
gl := GenerateGridLines(ticks, Style{}, Style{})
assert.Len(2, gl)
assert.Len(gl, 2)
assert.Equal(2.0, gl[0].Value)
assert.Equal(3.0, gl[1].Value)

View File

@ -67,7 +67,7 @@ func TestMarketHoursRangeGetTicks(t *testing.T) {
ticks := ra.GetTicks(r, defaults, TimeValueFormatter)
assert.NotEmpty(ticks)
assert.Len(5, ticks)
assert.Len(ticks, 5)
assert.NotEqual(util.Time.ToFloat64(ra.Min), ticks[0].Value)
assert.NotEmpty(ticks[0].Label)
}

View File

@ -14,7 +14,7 @@ func TestPoly(t *testing.T) {
c, err := Poly(xGiven, yGiven, degree)
assert.Nil(err)
assert.Len(3, c)
assert.Len(c, 3)
assert.InDelta(c[0], 0.999999999, DefaultEpsilon)
assert.InDelta(c[1], 2, DefaultEpsilon)

View File

@ -132,7 +132,7 @@ func TestBufferArray(t *testing.T) {
buffer.Enqueue(5)
contents := buffer.Array()
assert.Len(5, contents)
assert.Len(contents, 5)
assert.Equal(1, contents[0])
assert.Equal(2, contents[1])
assert.Equal(3, contents[2])

View File

@ -10,7 +10,7 @@ func TestRange(t *testing.T) {
assert := assert.New(t)
values := Range(1, 100)
assert.Len(100, values)
assert.Len(values, 100)
assert.Equal(1, values[0])
assert.Equal(100, values[99])
}
@ -20,7 +20,7 @@ func TestRangeWithStep(t *testing.T) {
values := RangeWithStep(0, 100, 5)
assert.Equal(100, values[20])
assert.Len(21, values)
assert.Len(values, 21)
}
func TestRangeReversed(t *testing.T) {
@ -42,7 +42,7 @@ func TestValuesRegression(t *testing.T) {
assert.Equal(100, linearProvider.Len())
values := Seq{Provider: linearProvider}.Array()
assert.Len(100, values)
assert.Len(values, 100)
assert.Equal(1.0, values[0])
assert.Equal(100, values[99])
}

View File

@ -15,6 +15,6 @@ func TestRandomRegression(t *testing.T) {
randomSequence := New(randomProvider)
randomValues := randomSequence.Array()
assert.Len(4096, randomValues)
assert.Len(randomValues, 4096)
assert.InDelta(128, randomSequence.Average(), 10.0)
}

View File

@ -88,7 +88,7 @@ func TestSequenceNormalize(t *testing.T) {
normalized := Values(1, 2, 3, 4, 5).Normalize().Array()
assert.NotEmpty(normalized)
assert.Len(5, normalized)
assert.Len(normalized, 5)
assert.Equal(0, normalized[0])
assert.Equal(0.25, normalized[1])
assert.Equal(1, normalized[4])

View File

@ -13,7 +13,7 @@ func TestTimeMarketHours(t *testing.T) {
today := time.Date(2016, 07, 01, 12, 0, 0, 0, util.Date.Eastern())
mh := Time.MarketHours(today, today, util.NYSEOpen(), util.NYSEClose(), util.Date.IsNYSEHoliday)
assert.Len(8, mh)
assert.Len(mh, 8)
assert.Equal(util.Date.Eastern(), mh[0].Location())
}
@ -21,7 +21,7 @@ func TestTimeMarketHourQuarters(t *testing.T) {
assert := assert.New(t)
today := time.Date(2016, 07, 01, 12, 0, 0, 0, util.Date.Eastern())
mh := Time.MarketHourQuarters(today, today, util.NYSEOpen(), util.NYSEClose(), util.Date.IsNYSEHoliday)
assert.Len(4, mh)
assert.Len(mh, 4)
assert.Equal(9, mh[0].Hour())
assert.Equal(30, mh[0].Minute())
assert.Equal(util.Date.Eastern(), mh[0].Location())
@ -42,7 +42,7 @@ func TestTimeHours(t *testing.T) {
seq := Time.Hours(today, 24)
end := Time.End(seq)
assert.Len(24, seq)
assert.Len(seq, 24)
assert.Equal(2016, end.Year())
assert.Equal(07, int(end.Month()))
assert.Equal(02, end.Day())
@ -74,7 +74,7 @@ func TestSequenceHoursFill(t *testing.T) {
filledTimes, filledValues := Time.HoursFilled(xdata, ydata)
expected := util.Date.DiffHours(Time.Start(xdata), Time.End(xdata)) + 1
assert.Len(expected, filledTimes)
assert.Len(filledTimes, expected)
assert.Equal(len(filledValues), len(filledTimes))
assert.NotZero(filledValues[0])

View File

@ -18,7 +18,7 @@ func TestTextWrapWord(t *testing.T) {
output := Text.WrapFitWord(r, "this is a test string", 100, basicTextStyle)
assert.NotEmpty(output)
assert.Len(3, output)
assert.Len(output, 3)
for _, line := range output {
basicTextStyle.WriteToRenderer(r)
@ -30,16 +30,16 @@ func TestTextWrapWord(t *testing.T) {
assert.Equal("string", output[2])
output = Text.WrapFitWord(r, "foo", 100, basicTextStyle)
assert.Len(1, output)
assert.Len(output, 1)
assert.Equal("foo", output[0])
// test that it handles newlines.
output = Text.WrapFitWord(r, "this\nis\na\ntest\nstring", 100, basicTextStyle)
assert.Len(5, output)
assert.Len(output, 5)
// test that it handles newlines and long lines.
output = Text.WrapFitWord(r, "this\nis\na\ntest\nstring that is very long", 100, basicTextStyle)
assert.Len(8, output)
assert.Len(output, 8)
}
func TestTextWrapRune(t *testing.T) {
@ -54,7 +54,7 @@ func TestTextWrapRune(t *testing.T) {
output := Text.WrapFitRune(r, "this is a test string", 150, basicTextStyle)
assert.NotEmpty(output)
assert.Len(2, output)
assert.Len(output, 2)
assert.Equal("this is a t", output[0])
assert.Equal("est string", output[1])
}

View File

@ -26,7 +26,7 @@ func TestGenerateContinuousTicks(t *testing.T) {
ticks := GenerateContinuousTicks(r, ra, false, Style{}, vf)
assert.NotEmpty(ticks)
assert.Len(11, ticks)
assert.Len(ticks, 11)
assert.Equal(0.0, ticks[0].Value)
assert.Equal(10, ticks[len(ticks)-1].Value)
}
@ -52,7 +52,7 @@ func TestGenerateContinuousTicksDescending(t *testing.T) {
ticks := GenerateContinuousTicks(r, ra, false, Style{}, vf)
assert.NotEmpty(ticks)
assert.Len(11, ticks)
assert.Len(ticks, 11)
assert.Equal(10.0, ticks[0].Value)
assert.Equal(9.0, ticks[1].Value)
assert.Equal(1.0, ticks[len(ticks)-2].Value)

View File

@ -101,7 +101,7 @@ func TestNormalize(t *testing.T) {
values := []float64{10, 9, 8, 7, 6}
normalized := Math.Normalize(values...)
assert.Len(5, normalized)
assert.Len(normalized, 5)
assert.Equal(0.25, normalized[0])
assert.Equal(0.1499, normalized[4])
}

View File

@ -20,7 +20,7 @@ func TestValuesValues(t *testing.T) {
}
values := Values(vs).Values()
assert.Len(7, values)
assert.Len(values, 7)
assert.Equal(10, values[0])
assert.Equal(9, values[1])
assert.Equal(8, values[2])
@ -44,7 +44,7 @@ func TestValuesValuesNormalized(t *testing.T) {
}
values := Values(vs).ValuesNormalized()
assert.Len(7, values)
assert.Len(values, 7)
assert.Equal(0.2127, values[0])
assert.Equal(0.0425, values[6])
}
@ -63,7 +63,7 @@ func TestValuesNormalize(t *testing.T) {
}
values := Values(vs).Normalize()
assert.Len(7, values)
assert.Len(values, 7)
assert.Equal(0.2127, values[0].Value)
assert.Equal(0.0425, values[6].Value)
}

View File

@ -23,7 +23,7 @@ func TestXAxisGetTicks(t *testing.T) {
}
vf := FloatValueFormatter
ticks := xa.GetTicks(r, xr, styleDefaults, vf)
assert.Len(16, ticks)
assert.Len(ticks, 16)
}
func TestXAxisGetTicksWithUserDefaults(t *testing.T) {
@ -45,7 +45,7 @@ func TestXAxisGetTicksWithUserDefaults(t *testing.T) {
}
vf := FloatValueFormatter
ticks := xa.GetTicks(r, xr, styleDefaults, vf)
assert.Len(1, ticks)
assert.Len(ticks, 1)
}
func TestXAxisMeasure(t *testing.T) {

View File

@ -23,7 +23,7 @@ func TestYAxisGetTicks(t *testing.T) {
}
vf := FloatValueFormatter
ticks := ya.GetTicks(r, yr, styleDefaults, vf)
assert.Len(32, ticks)
assert.Len(ticks, 32)
}
func TestYAxisGetTicksWithUserDefaults(t *testing.T) {
@ -45,7 +45,7 @@ func TestYAxisGetTicksWithUserDefaults(t *testing.T) {
}
vf := FloatValueFormatter
ticks := ya.GetTicks(r, yr, styleDefaults, vf)
assert.Len(1, ticks)
assert.Len(ticks, 1)
}
func TestYAxisMeasure(t *testing.T) {