-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug_test.go
51 lines (36 loc) · 1.59 KB
/
debug_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"encoding/json"
"fmt"
"testing"
"time"
)
func TestTime(t *testing.T) {
// go test -timeout 30s sector-checker -run ^TestTime
// Running tool: /usr/local/go/bin/go test -coverprofile=/var/folders/v3/htc95bpx66g15z5tqrm3d2800000gn/T/go-code-cover -timeout 30s -run ^TestTime$
windowpostStart := time.Now()
// time.Sleep(time.Duration(10) * time.Second)
windowpost1 := windowpostStart.Add(time.Duration(3*60) * time.Second)
// windowpost1 := time.Now()
PostGenerateCandidates := windowpost1.Sub(windowpostStart)
verifyWindowpost1 := windowpost1.Add(time.Duration(5*60) * time.Second)
bo := CheckResults{}
bo.PostGenerateCandidates = windowpost1.Sub(windowpostStart)
bo.VerifyWinningPostCold = verifyWindowpost1.Sub(windowpost1)
// bo.PostGenerateCandidatesM = bo.PostGenerateCandidates.Truncate(time.Millisecond * 100)
// bo.VerifyWinningPostColdM = bo.VerifyWinningPostCold.Truncate(time.Millisecond * 100)
fmt.Printf("bo == %+v:\n", bo)
fmt.Printf("PostGenerateCandidates == %+v:\n", bo.PostGenerateCandidates)
fmt.Printf("VerifyWinningPostCold == %+v:\n", bo.VerifyWinningPostCold)
fmt.Printf("PostGenerateCandidatesM == %+v:\n", bo.PostGenerateCandidatesM)
fmt.Printf("VerifyWinningPostColdM == %+v:\n", bo.VerifyWinningPostColdM)
data, err := json.MarshalIndent(bo, "", " ")
if err != nil {
fmt.Println("err == :", err)
}
fmt.Println(string(data))
// t.Logf("windowpostStart: %v, windowpost1: %v, PostGenerateCandidates: %v", windowpostStart, windowpost1, PostGenerateCandidates)
t.Log(windowpostStart)
t.Log(windowpost1)
t.Log(PostGenerateCandidates)
}