MCPcopy Create free account
hub / github.com/google/gapid / ExampleTime

Function ExampleTime

core/assert/time_test.go:24–37  ·  view source on GitHub ↗

An example of testing time durations

()

Source from the content-addressed store, hash-verified

22
23// An example of testing time durations
24func ExampleTime() {
25 assert := assert.To(nil)
26 assert.For("1s IsAtLeast 2s").ThatDuration(time.Second * 1).IsAtLeast(time.Second * 2)
27 assert.For("3s IsAtMost 4s").ThatDuration(time.Second * 3).IsAtMost(time.Second * 4)
28 assert.For("6s IsAtLeast 5s").ThatDuration(time.Second * 6).IsAtLeast(time.Second * 5)
29 assert.For("8s IsAtMost 7s").ThatDuration(time.Second * 8).IsAtMost(time.Second * 7)
30 // Output:
31 // Error:1s IsAtLeast 2s
32 // Got 1s
33 // Expect >= 2s
34 // Error:8s IsAtMost 7s
35 // Got 8s
36 // Expect <= 7s
37}

Callers

nothing calls this directly

Calls 4

ThatDurationMethod · 0.80
ForMethod · 0.80
IsAtLeastMethod · 0.45
IsAtMostMethod · 0.45

Tested by

no test coverage detected