gf/g/os/gwheel/gwheel_z_unit_3_test.go
2019-01-11 13:46:40 +08:00

29 lines
729 B
Go

// Copyright 2018 gf Author(https://gitee.com/johng/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://gitee.com/johng/gf.
// 指定次数运行测试
package gwheel_test
import (
"gitee.com/johng/gf/g/container/garray"
"gitee.com/johng/gf/g/util/gtest"
"testing"
"time"
)
func TestWheel_Times(t *testing.T) {
gtest.Case(t, func() {
wheel := New()
array := garray.New(0, 0)
wheel.AddTimes(time.Second, 2, func() {
array.Append(1)
})
time.Sleep(3500*time.Millisecond)
gtest.Assert(array.Len(), 2)
})
}