Ejemplo n.º 1
0
func TestStddevNormalOne(t *testing.T) {
	result, err := mino.FromList(one).Transform(transform.Stddev{})
	r := result.(transform.StddevResults)
	assert.Equal(t, transform.InsufficientDataError, err)
	assert.InEpsilon(t, 0, r.Deviation, epsilon)
	assert.InEpsilon(t, 1, r.Average, epsilon)
}
Ejemplo n.º 2
0
func TestStddevBessel(t *testing.T) {
	result, err := mino.FromList(fibonacci).Transform(transform.Stddev{Bessel: true})
	assert.Nil(t, err)

	r := result.(transform.StddevResults)
	assert.InEpsilon(t, 7.0660, r.Deviation, epsilon)
	assert.InEpsilon(t, 6.7500, r.Average, epsilon)
}
Ejemplo n.º 3
0
func TestQuartileSameSectionAsNumbers(t *testing.T) {
	result, err := mino.FromList([]float64{1, 2}).Transform(transform.Quartile{Sections: 2})
	assert.Nil(t, err)
	assert.Equal(t, []float64{1.5}, result.([]float64))
}
Ejemplo n.º 4
0
func TestQuartileEmpty(t *testing.T) {
	_, err := mino.FromList(empty).Transform(transform.Quartile{})
	assert.Equal(t, transform.InsufficientDataError, err)
}
Ejemplo n.º 5
0
func TestFourQuartiles(t *testing.T) {
	result, err := mino.FromList(fibonacci).Transform(transform.Quartile{})
	assert.Nil(t, err)
	assert.Equal(t, []float64{1.25, 4, 11.75}, result.([]float64))
}
Ejemplo n.º 6
0
func TestThreeQuartiles(t *testing.T) {
	result, err := mino.FromList(fibonacci).Transform(transform.Quartile{Sections: 3})
	assert.Nil(t, err)
	assert.Equal(t, []float64{2, 8}, result.([]float64))
}
Ejemplo n.º 7
0
func TestAverageEmpty(t *testing.T) {
	result, err := mino.FromList(empty).Transform(transform.Average{})
	assert.Nil(t, err)
	assert.Equal(t, float64(0), result.(float64))
}
Ejemplo n.º 8
0
func TestAverage(t *testing.T) {
	result, err := mino.FromList(fibonacci).Transform(transform.Average{})
	assert.Nil(t, err)
	assert.Equal(t, float64(6.75), result.(float64))
}
Ejemplo n.º 9
0
func TestSum(t *testing.T) {
	result, err := mino.FromList(fibonacci).Transform(transform.Sum{})
	assert.Nil(t, err)
	assert.Equal(t, float64(54), result.(float64))
}