goProject/.svn/pristine/6b/6b7ee254db7c164592c699679747f995b2fc8873.svn-base
2025-01-06 16:21:36 +08:00

38 lines
786 B
Plaintext

package fileUtil
import (
"fmt"
"testing"
)
func BenchmarkSaveMessage(b *testing.B) {
path := GetCurrentPath()
fmt.Printf("CurrPath:%s\n", path)
bigFileObj, err := NewBigFile(path, 1024*1024*1024)
if err != nil {
b.Errorf("there should no err, but not there is:%s", err)
}
for i := 0; i < b.N; i++ {
bigFileObj.SaveMessage(fmt.Sprintf("line %d", i))
}
}
func TestSaveMessage(t *testing.T) {
path := GetCurrentPath()
fmt.Printf("CurrPath:%s\n", path)
bigFileObj, err := NewBigFile(path, 1024)
if err != nil {
t.Errorf("there should no err, but not there is:%s", err)
}
for i := 0; i < 100000; i++ {
bigFileObj.SaveMessage(fmt.Sprintf("line %d", i))
}
fileList, err := GetFileList(path)
for _, item := range fileList {
fmt.Printf("file:%s\n", item)
}
}