diff --git a/g/crypto/gcrc32/gcrc32_test.go b/g/crypto/gcrc32/gcrc32_test.go index 73219d531..32f9a3094 100644 --- a/g/crypto/gcrc32/gcrc32_test.go +++ b/g/crypto/gcrc32/gcrc32_test.go @@ -18,8 +18,10 @@ import ( func TestEncrypt(t *testing.T) { gtest.Case(t, func() { s := "pibigstar" + result := 693191136 encrypt1 := gcrc32.EncryptString(s) encrypt2 := gcrc32.EncryptBytes([]byte(s)) - gtest.AssertEQ(encrypt1, encrypt2) + gtest.AssertEQ(int(encrypt1), result) + gtest.AssertEQ(int(encrypt2), result) }) } diff --git a/g/crypto/gmd5/gmd5_test.go b/g/crypto/gmd5/gmd5_test.go index ebc43a498..91b767409 100644 --- a/g/crypto/gmd5/gmd5_test.go +++ b/g/crypto/gmd5/gmd5_test.go @@ -60,8 +60,9 @@ func TestEncryptFile(t *testing.T) { errorPath := "err.txt" gtest.Case(t, func() { file, err := os.Create(path) - gtest.Assert(err, nil) + defer os.Remove(path) defer file.Close() + gtest.Assert(err, nil) file.Write([]byte("Hello Go Frame")) encryptFile := gmd5.EncryptFile(path) gtest.AssertNE(encryptFile, "") @@ -70,5 +71,5 @@ func TestEncryptFile(t *testing.T) { gtest.AssertEQ(errEncrypt, "") }) - defer os.Remove(path) + } diff --git a/g/crypto/gsha1/gsha1_test.go b/g/crypto/gsha1/gsha1_test.go index 3593b09a9..042318210 100644 --- a/g/crypto/gsha1/gsha1_test.go +++ b/g/crypto/gsha1/gsha1_test.go @@ -50,13 +50,13 @@ func TestEncryptFile(t *testing.T) { errPath := "err.text" gtest.Case(t, func() { file, err := os.Create(path) - gtest.Assert(err, nil) + defer os.Remove(path) defer file.Close() + gtest.Assert(err, nil) file.Write([]byte("Hello Go Frame")) encryptFile := gsha1.EncryptFile(path) gtest.AssertNE(encryptFile, "") errEncrypt := gsha1.EncryptFile(errPath) gtest.AssertEQ(errEncrypt,"") }) - defer os.Remove(path) }