(t *testing.T)
| 162 | } |
| 163 | |
| 164 | func TestClockSetStep(t *testing.T) { |
| 165 | t.Parallel() |
| 166 | |
| 167 | type stepInfo struct { |
| 168 | when int |
| 169 | step time.Duration |
| 170 | } |
| 171 | |
| 172 | tests := []struct { |
| 173 | name string |
| 174 | start time.Time |
| 175 | step time.Duration |
| 176 | stepChanges []stepInfo |
| 177 | wants []time.Time // The return values of sequential calls to Now(). |
| 178 | }{ |
| 179 | { |
| 180 | name: "increment-ms-then-s", |
| 181 | start: time.Unix(12345, 1000), |
| 182 | step: 1000, |
| 183 | stepChanges: []stepInfo{ |
| 184 | { |
| 185 | when: 4, |
| 186 | step: time.Second, |
| 187 | }, |
| 188 | }, |
| 189 | wants: []time.Time{ |
| 190 | time.Unix(12345, 1000), |
| 191 | time.Unix(12345, 2000), |
| 192 | time.Unix(12345, 3000), |
| 193 | time.Unix(12345, 4000), |
| 194 | time.Unix(12346, 4000), |
| 195 | time.Unix(12347, 4000), |
| 196 | time.Unix(12348, 4000), |
| 197 | time.Unix(12349, 4000), |
| 198 | }, |
| 199 | }, |
| 200 | { |
| 201 | name: "multiple-changes-over-time", |
| 202 | start: time.Unix(12345, 1000), |
| 203 | step: 1, |
| 204 | stepChanges: []stepInfo{ |
| 205 | { |
| 206 | when: 2, |
| 207 | step: time.Second, |
| 208 | }, |
| 209 | { |
| 210 | when: 4, |
| 211 | step: 0, |
| 212 | }, |
| 213 | { |
| 214 | when: 6, |
| 215 | step: 1000, |
| 216 | }, |
| 217 | }, |
| 218 | wants: []time.Time{ |
| 219 | time.Unix(12345, 1000), |
| 220 | time.Unix(12345, 1001), |
| 221 | time.Unix(12346, 1001), |
nothing calls this directly
no test coverage detected
searching dependent graphs…