gitee.com/quant1x/engine@v1.8.4/config/range_test.go (about)

     1  package config
     2  
     3  import (
     4  	"fmt"
     5  	"math"
     6  	"testing"
     7  )
     8  
     9  func TestParseRange(t *testing.T) {
    10  	v := math.SmallestNonzeroFloat64
    11  	fmt.Println(v)
    12  	v = math.MaxFloat64
    13  	fmt.Println(v)
    14  	fmt.Println(-10000000000.00 < v)
    15  
    16  	rn := NumberRange{}
    17  	ok := rn.Validate(100)
    18  	fmt.Println(ok)
    19  }
    20  
    21  func TestNumberRange(t *testing.T) {
    22  	text := ""
    23  	fmt.Println("==>", text)
    24  	var r NumberRange
    25  	err := r.Parse(text)
    26  	fmt.Println(r, err)
    27  	fmt.Println(-1000000 < r.Min())
    28  	text = "1"
    29  	fmt.Println("==>", text)
    30  	err = r.Parse(text)
    31  	fmt.Println(r, err)
    32  	text = "1~"
    33  	fmt.Println("==>", text)
    34  	err = r.Parse(text)
    35  	fmt.Println(r, err)
    36  	text = "~1"
    37  	fmt.Println("==>", text)
    38  	err = r.Parse(text)
    39  	fmt.Println(r, err)
    40  	text = "1~2"
    41  	fmt.Println("==>", text)
    42  	err = r.Parse(text)
    43  	fmt.Println(r, err)
    44  	text = "1~2~3"
    45  	fmt.Println("==>", text)
    46  	err = r.Parse(text)
    47  	fmt.Println(r, err)
    48  }