github.com/sandwich-go/boost@v1.3.29/xhash/md5/md5_test.go (about)

     1  package md5
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  	"github.com/sandwich-go/boost/xhash/nhash/jenkins"
     7  	. "github.com/smartystreets/goconvey/convey"
     8  	"os"
     9  	"testing"
    10  )
    11  
    12  func TestMd5(t *testing.T) {
    13  	Convey("md5", t, func() {
    14  		s, err := File("test")
    15  		So(err, ShouldBeNil)
    16  
    17  		f, err0 := os.Open("test")
    18  		So(err0, ShouldBeNil)
    19  		defer func() {
    20  			_ = f.Close()
    21  		}()
    22  		s1, err1 := Buffer(f)
    23  		So(err1, ShouldBeNil)
    24  		So(s, ShouldEqual, s1)
    25  
    26  		s2, err2 := Buffer(bytes.NewReader([]byte("aaaaaaaa")))
    27  		So(err2, ShouldBeNil)
    28  		t.Log(s2)
    29  
    30  		hint, _ := jenkins.HashString("aaaaaaaa", 0, 0)
    31  		fmt.Println(hint)
    32  	})
    33  }