main_test.go 531 Bytes
Newer Older
liming6's avatar
liming6 committed
1
2
3
4
5
6
7
8
9
10
package backend

import (
	"testing"
	"time"
)

func TestUpdateDCUInfo(t *testing.T) {
	for i := 0; i < 10; i++ {
		start := time.Now()
liming6's avatar
liming6 committed
11
		UpdateDCUInfo(false)
liming6's avatar
liming6 committed
12
13
14
15
		end := time.Now()
		t.Logf("%d ms", end.Sub(start).Milliseconds())
	}
}
liming6's avatar
liming6 committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29

func TestGetDCUInfo(t *testing.T) {
	UpdateDCUInfo(true)
	info := GetDCUInfo()
	t.Logf("%+v", info)
	for i := range 10 {
		time.Sleep(time.Second)
		start := time.Now()
		UpdateDCUInfo(false)
		info = GetDCUInfo()
		tt := time.Since(start).Milliseconds()
		t.Logf("%d|%d : %+v", i, tt, info)
	}
}