2015-10-05 19:56:21 +00:00
|
|
|
package adjacency
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
/*
|
|
|
|
nbutton: Really the value is not as important to me than they don't change, which happened during development.
|
|
|
|
*/
|
|
|
|
func TestCalculateDegreeQwert(t *testing.T) {
|
2015-10-06 18:43:37 +00:00
|
|
|
avgDegreeQwert := buildQwerty().CalculateAvgDegree()
|
2015-10-05 19:56:21 +00:00
|
|
|
|
|
|
|
assert.Equal(t, float32(1.531915), avgDegreeQwert, "Avg degree for qwerty should be 1.531915")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCalculateDegreeDvorak(t *testing.T) {
|
2015-10-06 18:43:37 +00:00
|
|
|
avgDegreeQwert := buildDvorak().CalculateAvgDegree()
|
2015-10-05 19:56:21 +00:00
|
|
|
|
|
|
|
assert.Equal(t, float32(1.531915), avgDegreeQwert, "Avg degree for dvorak should be 1.531915")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCalculateDegreeKeypad(t *testing.T) {
|
2015-10-06 18:43:37 +00:00
|
|
|
avgDegreeQwert := buildKeypad().CalculateAvgDegree()
|
2015-10-05 19:56:21 +00:00
|
|
|
|
|
|
|
assert.Equal(t, float32(0.62222224), avgDegreeQwert, "Avg degree for keypad should be 0.62222224")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCalculateDegreeMacKepad(t *testing.T) {
|
2015-10-06 18:43:37 +00:00
|
|
|
avgDegreeQwert := buildMacKeypad().CalculateAvgDegree()
|
2015-10-05 19:56:21 +00:00
|
|
|
|
|
|
|
assert.Equal(t, float32(0.6458333), avgDegreeQwert, "Avg degree for mackeyPad should be 0.6458333")
|
|
|
|
}
|
|
|
|
|