MCPcopy
hub / github.com/lxc/incus / TestRange_String

Function TestRange_String

internal/iprange/range_test.go:104–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func TestRange_String(t *testing.T) {
105 type stringTest struct {
106 name string
107 rangeString string // a string of format <ip>-<ip> optionally just an <ip>
108 expected string
109 }
110
111 tests := []stringTest{
112 {
113 name: "start and end",
114 rangeString: "10.10.0.0-10.16.0.5",
115 expected: "10.10.0.0-10.16.0.5",
116 },
117 {
118 name: "start only",
119 rangeString: "10.10.0.0",
120 expected: "10.10.0.0",
121 },
122 }
123
124 for _, test := range tests {
125 t.Run(test.name, func(t *testing.T) {
126 // arrange
127 r := parseRange(test.rangeString)
128
129 // act
130 s := r.String()
131
132 // assert
133 assert.Equal(t, test.expected, s)
134 })
135 }
136}

Callers

nothing calls this directly

Calls 3

parseRangeFunction · 0.85
StringMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…