github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/values/number_list_test.go (about)

     1  // Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
     2  
     3  package values_test
     4  
     5  import (
     6  	"github.com/TeaOSLab/EdgeNode/internal/waf/values"
     7  	"github.com/iwind/TeaGo/assert"
     8  	"testing"
     9  )
    10  
    11  func TestParseNumberList(t *testing.T) {
    12  	var a = assert.NewAssertion(t)
    13  
    14  	{
    15  		var list = values.ParseNumberList("")
    16  		a.IsFalse(list.Contains(123))
    17  	}
    18  
    19  	{
    20  		var list = values.ParseNumberList(`123
    21  456
    22  
    23  789.1234`)
    24  		a.IsTrue(list.Contains(123))
    25  		a.IsFalse(list.Contains(0))
    26  		a.IsFalse(list.Contains(789.123))
    27  		a.IsTrue(list.Contains(789.1234))
    28  	}
    29  }