github.com/KEINOS/go-sortfile@v0.0.1-rc20230124/sortfile/benchmark_test.go (about)

     1  package sortfile
     2  
     3  import (
     4  	"path/filepath"
     5  	"testing"
     6  )
     7  
     8  func BenchmarkFromPath(b *testing.B) {
     9  	pathFileIn := filepath.Join("testdata", "shuffled_huge.txt")
    10  	pathFileOut := filepath.Join(b.TempDir(), b.Name()+".txt")
    11  	forceExternalSort := true
    12  
    13  	if !FileExists(pathFileIn) {
    14  		b.Skip("the huge file for benchmarking does not exist. Run 'go generate ./...' to generate it first.")
    15  	}
    16  
    17  	b.ResetTimer()
    18  
    19  	err := FromPath(pathFileIn, pathFileOut, forceExternalSort)
    20  	if err != nil {
    21  		b.Fatal(err)
    22  	}
    23  }