github.com/songzhibin97/go-baseutils@v0.0.2-0.20240302024150-487d8ce9c082/base/bmath/example_test.go (about)

     1  package bmath
     2  
     3  import "fmt"
     4  
     5  func ExampleAbs() {
     6  	fmt.Println(Abs[int](1))  // 1
     7  	fmt.Println(Abs[int](0))  // 0
     8  	fmt.Println(Abs[int](-1)) // 1
     9  }
    10  
    11  func ExampleMax() {
    12  	fmt.Println(Max[int](1, 2)) // 2
    13  }
    14  
    15  func ExampleMin() {
    16  	fmt.Println(Min[int](1, 2)) // 1
    17  }