all: modify import path, change version to v0.8.0

This commit is contained in:
fatedier
2016-08-11 16:10:44 +08:00
parent 9c0ca8675d
commit d4ecc2218d
32 changed files with 59 additions and 59 deletions

View File

@@ -0,0 +1,62 @@
// Copyright 2016 fatedier, fatedier@gmail.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pcrypto
import (
"testing"
)
var (
pp *Pcrypto
)
func init() {
pp = &Pcrypto{}
pp.Init([]byte("Hana"))
}
func TestEncrypt(t *testing.T) {
testStr := "Test Encrypt!"
res, err := pp.Encrypt([]byte(testStr))
if err != nil {
t.Fatalf("encrypt error: %v", err)
}
res, err = pp.Decrypt([]byte(res))
if err != nil {
t.Fatalf("decrypt error: %v", err)
}
if string(res) != testStr {
t.Fatalf("test encrypt error, from [%s] to [%s]", testStr, string(res))
}
}
func TestCompression(t *testing.T) {
testStr := "Test Compression!"
res, err := pp.Compression([]byte(testStr))
if err != nil {
t.Fatalf("compression error: %v", err)
}
res, err = pp.Decompression(res)
if err != nil {
t.Fatalf("decompression error: %v", err)
}
if string(res) != testStr {
t.Fatalf("test compression error, from [%s] to [%s]", testStr, string(res))
}
}