Files
clr-installer/crypt/crypt_test.go
T
Leandro Dorileo c9bafa6920 crypt: add Crypt() tests
We make sure multiple calls to crypt return different hashes.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
2018-10-02 14:16:42 -07:00

28 lines
458 B
Go

// Copyright © 2018 Intel Corporation
//
// SPDX-License-Identifier: GPL-3.0-only
package crypt
import (
"testing"
)
func TestCrypt(t *testing.T) {
str := "a string to be hashed"
hashed, err := Crypt(str)
if err != nil {
t.Fatalf("Should not fail to hash the string")
}
hashed2, err := Crypt(str)
if err != nil {
t.Fatalf("Should not fail to hash the string")
}
if hashed2 == hashed {
t.Fatalf("The hashes should not be the same")
}
}