38 lines
724 B
Go
38 lines
724 B
Go
package guardianextension
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestQuestionHash(t *testing.T) {
|
|
tests := []struct {
|
|
question string
|
|
expected string
|
|
}{
|
|
{
|
|
question: "What is your name?",
|
|
expected: "3c42bcf12462b2875ba67f912cb680a2",
|
|
},
|
|
{
|
|
question: "How old are you?",
|
|
expected: "349383e43828e53221c3af2efb8715d4",
|
|
},
|
|
{
|
|
question: "",
|
|
expected: "00000000000000000000000000000000",
|
|
},
|
|
{
|
|
question: "The quick brown fox jumps over the lazy dog",
|
|
expected: "e34bbc7bbc071b6c7a433ca9c49a9347",
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.question, func(t *testing.T) {
|
|
hash := questionHash(tt.question)
|
|
assert.Equal(t, tt.expected, hash)
|
|
})
|
|
}
|
|
}
|