//go:build windows

package yu_proxy_pool

import (
	"fmt"
	yu_proxy "gogs.qqck.cn/s/tools/proxy"
	yu_rand "gogs.qqck.cn/s/tools/rand"
	"testing"
	"time"
)

func TestPool_GetCheck(t *testing.T) {
	j_pool := New().SetGetMax(10)
	j_pool.SetUrl("http://api.hailiangip.com:8422/api/getIp?type=1&num=10&pid=17&unbindTime=60&cid=-1&orderId=O23110418445724522113&time=1699772813&sign=44ab2df7bb4157420ddfa72e6394e7b7&noDuplicate=0&dataType=1&lineSeparator=0")
	for i := 0; i < 5; i++ {
		go func() {
			time.Sleep(time.Millisecond * time.Duration(yu_rand.Int31n(1000)))
			fmt.Println(j_pool.GetCheck(func(info *yu_proxy.Info) bool {
				fmt.Println("GetCheck")
				return true
			}))
		}()
	}
	time.Sleep(time.Second * 5)
}

func TestPool_GetCheckEx(t *testing.T) {
	j_pool := New().SetGetMax(10)
	j_pool.SetUrl("http://api.hailiangip.com:8422/api/getIp?type=1&num=10&pid=17&unbindTime=60&cid=-1&orderId=O23110418445724522113&time=1699772813&sign=44ab2df7bb4157420ddfa72e6394e7b7&noDuplicate=0&dataType=1&lineSeparator=0")
	for i := 0; i < 5; i++ {
		go func() {
			time.Sleep(time.Millisecond * time.Duration(yu_rand.Int31n(1000)))
			fmt.Println(j_pool.GetCheckEx(func(info *yu_proxy.Info) bool {
				fmt.Println("GetCheckEx")
				return true
			}))
		}()
	}
	time.Sleep(time.Second * 5)
}
