github.com/GuanceCloud/cliutils@v1.1.21/pprofparser/tools/mathtoolkit/math_test.go (about)

     1  package mathtoolkit
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  )
     7  
     8  func TestTrunc(t *testing.T) {
     9  	if Trunc(3.1415926) != 3 {
    10  		t.Fatal("trunc result wrong")
    11  	}
    12  
    13  	fmt.Println(Trunc(3))
    14  	fmt.Println(Trunc(5.9999999999))
    15  	fmt.Println(Trunc(-3.00001))
    16  	fmt.Println(Trunc(0))
    17  	fmt.Println(Trunc(3.00000002))
    18  }