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

Function ExampleInteger

core/assert/integer_test.go:20–49  ·  view source on GitHub ↗

An example of testing integer values

()

Source from the content-addressed store, hash-verified

18
19// An example of testing integer values
20func ExampleInteger() {
21 assert := assert.To(nil)
22 assert.For("1 Equals 2").ThatInteger(1).Equals(2)
23 assert.For("1 NotEquals 2").ThatInteger(1).NotEquals(2)
24 assert.For("1 IsAtLeast 2").ThatInteger(1).IsAtLeast(2)
25 assert.For("3 IsAtMost 4").ThatInteger(3).IsAtMost(4)
26 assert.For("6 IsAtLeast 5").ThatInteger(6).IsAtLeast(5)
27 assert.For("8 IsAtMost 7").ThatInteger(8).IsAtMost(7)
28 assert.For("3 IsBetween [2, 4]").ThatInteger(3).IsBetween(2, 4)
29 assert.For("3 IsBetween [3, 4]").ThatInteger(3).IsBetween(3, 4)
30 assert.For("3 IsBetween [2, 3]").ThatInteger(3).IsBetween(2, 3)
31 assert.For("3 IsBetween [4, 5]").ThatInteger(3).IsBetween(4, 5)
32 assert.For("3 IsBetween [1, 2]").ThatInteger(3).IsBetween(1, 2)
33 // Output:
34 // Error:1 Equals 2
35 // Got 1
36 // Expect == 2
37 // Error:1 IsAtLeast 2
38 // Got 1
39 // Expect >= 2
40 // Error:8 IsAtMost 7
41 // Got 8
42 // Expect <= 7
43 // Error:3 IsBetween [4, 5]
44 // Got 3
45 // Expect in 4 to 5
46 // Error:3 IsBetween [1, 2]
47 // Got 3
48 // Expect in 1 to 2
49}

Callers

nothing calls this directly

Calls 7

ThatIntegerMethod · 0.80
ForMethod · 0.80
IsBetweenMethod · 0.80
EqualsMethod · 0.65
NotEqualsMethod · 0.45
IsAtLeastMethod · 0.45
IsAtMostMethod · 0.45

Tested by

no test coverage detected