2015-10-05 19:56:21 +00:00
|
|
|
package adjacency
|
|
|
|
|
|
|
|
import (
|
2016-01-13 22:02:53 +00:00
|
|
|
"github.com/nbutton23/zxcvbn-go/Godeps/_workspace/src/github.com/stretchr/testify/assert"
|
2015-10-05 19:56:21 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
/*
|
|
|
|
nbutton: Really the value is not as important to me than they don't change, which happened during development.
|
2016-01-13 22:02:53 +00:00
|
|
|
*/
|
2015-10-05 19:56:21 +00:00
|
|
|
func TestCalculateDegreeQwert(t *testing.T) {
|
2016-01-13 22:02:53 +00:00
|
|
|
avgDegreeQwert := BuildQwerty().CalculateAvgDegree()
|
2015-10-05 19:56:21 +00:00
|
|
|
|
2016-01-13 22:47:44 +00:00
|
|
|
assert.Equal(t, float64(1.5319148936170213), avgDegreeQwert, "Avg degree for qwerty should be 1.5319148936170213")
|
2015-10-05 19:56:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestCalculateDegreeDvorak(t *testing.T) {
|
2016-01-13 22:02:53 +00:00
|
|
|
avgDegreeQwert := BuildDvorak().CalculateAvgDegree()
|
2015-10-05 19:56:21 +00:00
|
|
|
|
2016-01-13 22:47:44 +00:00
|
|
|
assert.Equal(t, float64(1.5319148936170213), avgDegreeQwert, "Avg degree for dvorak should be 1.53191489361702135")
|
2015-10-05 19:56:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestCalculateDegreeKeypad(t *testing.T) {
|
2016-01-13 22:02:53 +00:00
|
|
|
avgDegreeQwert := BuildKeypad().CalculateAvgDegree()
|
2015-10-05 19:56:21 +00:00
|
|
|
|
2016-01-13 22:47:44 +00:00
|
|
|
assert.Equal(t, float64(0.6333333333333333), avgDegreeQwert, "Avg degree for keypad should be 0.6333333333333333")
|
2015-10-05 19:56:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestCalculateDegreeMacKepad(t *testing.T) {
|
2016-01-13 22:02:53 +00:00
|
|
|
avgDegreeQwert := BuildMacKeypad().CalculateAvgDegree()
|
2015-10-05 19:56:21 +00:00
|
|
|
|
2016-01-13 22:47:44 +00:00
|
|
|
assert.Equal(t, float64(0.65625), avgDegreeQwert, "Avg degree for mackeyPad should be 0.65625")
|
2015-10-05 19:56:21 +00:00
|
|
|
}
|