github.com/fzfile/BaiduPCS-Go@v0.0.0-20200606205115-4408961cf336/pcsutil/converter/size_test.go (about)

     1  package converter_test
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/fzfile/BaiduPCS-Go/pcsutil/converter"
     6  	"testing"
     7  )
     8  
     9  func TestParseFileSizeStr(t *testing.T) {
    10  	for _, v := range []string{"1k", "3.86mb", "4.001Gb", "32"} {
    11  		size, err := converter.ParseFileSizeStr(v)
    12  		if err != nil {
    13  			t.Fatalf("%s\n", err)
    14  		}
    15  		fmt.Println(v, size)
    16  	}
    17  }