github.com/insolar/vanilla@v0.0.0-20201023172447-248fdf805322/cryptkit/signature_holder_mock.go (about) 1 package cryptkit 2 3 // Code generated by http://github.com/gojuno/minimock (dev). DO NOT EDIT. 4 5 import ( 6 "io" 7 "sync" 8 mm_atomic "sync/atomic" 9 mm_time "time" 10 11 "github.com/gojuno/minimock/v3" 12 "github.com/insolar/vanilla/longbits" 13 ) 14 15 // SignatureHolderMock implements SignatureHolder 16 type SignatureHolderMock struct { 17 t minimock.Tester 18 19 funcAsByteString func() (b1 longbits.ByteString) 20 inspectFuncAsByteString func() 21 afterAsByteStringCounter uint64 22 beforeAsByteStringCounter uint64 23 AsByteStringMock mSignatureHolderMockAsByteString 24 25 funcCopyTo func(p []byte) (i1 int) 26 inspectFuncCopyTo func(p []byte) 27 afterCopyToCounter uint64 28 beforeCopyToCounter uint64 29 CopyToMock mSignatureHolderMockCopyTo 30 31 funcEquals func(other SignatureHolder) (b1 bool) 32 inspectFuncEquals func(other SignatureHolder) 33 afterEqualsCounter uint64 34 beforeEqualsCounter uint64 35 EqualsMock mSignatureHolderMockEquals 36 37 funcFixedByteSize func() (i1 int) 38 inspectFuncFixedByteSize func() 39 afterFixedByteSizeCounter uint64 40 beforeFixedByteSizeCounter uint64 41 FixedByteSizeMock mSignatureHolderMockFixedByteSize 42 43 funcFoldToUint64 func() (u1 uint64) 44 inspectFuncFoldToUint64 func() 45 afterFoldToUint64Counter uint64 46 beforeFoldToUint64Counter uint64 47 FoldToUint64Mock mSignatureHolderMockFoldToUint64 48 49 funcGetSignatureMethod func() (s1 SignatureMethod) 50 inspectFuncGetSignatureMethod func() 51 afterGetSignatureMethodCounter uint64 52 beforeGetSignatureMethodCounter uint64 53 GetSignatureMethodMock mSignatureHolderMockGetSignatureMethod 54 55 funcWriteTo func(w io.Writer) (n int64, err error) 56 inspectFuncWriteTo func(w io.Writer) 57 afterWriteToCounter uint64 58 beforeWriteToCounter uint64 59 WriteToMock mSignatureHolderMockWriteTo 60 } 61 62 // NewSignatureHolderMock returns a mock for SignatureHolder 63 func NewSignatureHolderMock(t minimock.Tester) *SignatureHolderMock { 64 m := &SignatureHolderMock{t: t} 65 if controller, ok := t.(minimock.MockController); ok { 66 controller.RegisterMocker(m) 67 } 68 69 m.AsByteStringMock = mSignatureHolderMockAsByteString{mock: m} 70 71 m.CopyToMock = mSignatureHolderMockCopyTo{mock: m} 72 m.CopyToMock.callArgs = []*SignatureHolderMockCopyToParams{} 73 74 m.EqualsMock = mSignatureHolderMockEquals{mock: m} 75 m.EqualsMock.callArgs = []*SignatureHolderMockEqualsParams{} 76 77 m.FixedByteSizeMock = mSignatureHolderMockFixedByteSize{mock: m} 78 79 m.FoldToUint64Mock = mSignatureHolderMockFoldToUint64{mock: m} 80 81 m.GetSignatureMethodMock = mSignatureHolderMockGetSignatureMethod{mock: m} 82 83 m.WriteToMock = mSignatureHolderMockWriteTo{mock: m} 84 m.WriteToMock.callArgs = []*SignatureHolderMockWriteToParams{} 85 86 return m 87 } 88 89 type mSignatureHolderMockAsByteString struct { 90 mock *SignatureHolderMock 91 defaultExpectation *SignatureHolderMockAsByteStringExpectation 92 expectations []*SignatureHolderMockAsByteStringExpectation 93 } 94 95 // SignatureHolderMockAsByteStringExpectation specifies expectation struct of the SignatureHolder.AsByteString 96 type SignatureHolderMockAsByteStringExpectation struct { 97 mock *SignatureHolderMock 98 99 results *SignatureHolderMockAsByteStringResults 100 Counter uint64 101 } 102 103 // SignatureHolderMockAsByteStringResults contains results of the SignatureHolder.AsByteString 104 type SignatureHolderMockAsByteStringResults struct { 105 b1 longbits.ByteString 106 } 107 108 // Expect sets up expected params for SignatureHolder.AsByteString 109 func (mmAsByteString *mSignatureHolderMockAsByteString) Expect() *mSignatureHolderMockAsByteString { 110 if mmAsByteString.mock.funcAsByteString != nil { 111 mmAsByteString.mock.t.Fatalf("SignatureHolderMock.AsByteString mock is already set by Set") 112 } 113 114 if mmAsByteString.defaultExpectation == nil { 115 mmAsByteString.defaultExpectation = &SignatureHolderMockAsByteStringExpectation{} 116 } 117 118 return mmAsByteString 119 } 120 121 // Inspect accepts an inspector function that has same arguments as the SignatureHolder.AsByteString 122 func (mmAsByteString *mSignatureHolderMockAsByteString) Inspect(f func()) *mSignatureHolderMockAsByteString { 123 if mmAsByteString.mock.inspectFuncAsByteString != nil { 124 mmAsByteString.mock.t.Fatalf("Inspect function is already set for SignatureHolderMock.AsByteString") 125 } 126 127 mmAsByteString.mock.inspectFuncAsByteString = f 128 129 return mmAsByteString 130 } 131 132 // Return sets up results that will be returned by SignatureHolder.AsByteString 133 func (mmAsByteString *mSignatureHolderMockAsByteString) Return(b1 longbits.ByteString) *SignatureHolderMock { 134 if mmAsByteString.mock.funcAsByteString != nil { 135 mmAsByteString.mock.t.Fatalf("SignatureHolderMock.AsByteString mock is already set by Set") 136 } 137 138 if mmAsByteString.defaultExpectation == nil { 139 mmAsByteString.defaultExpectation = &SignatureHolderMockAsByteStringExpectation{mock: mmAsByteString.mock} 140 } 141 mmAsByteString.defaultExpectation.results = &SignatureHolderMockAsByteStringResults{b1} 142 return mmAsByteString.mock 143 } 144 145 //Set uses given function f to mock the SignatureHolder.AsByteString method 146 func (mmAsByteString *mSignatureHolderMockAsByteString) Set(f func() (b1 longbits.ByteString)) *SignatureHolderMock { 147 if mmAsByteString.defaultExpectation != nil { 148 mmAsByteString.mock.t.Fatalf("Default expectation is already set for the SignatureHolder.AsByteString method") 149 } 150 151 if len(mmAsByteString.expectations) > 0 { 152 mmAsByteString.mock.t.Fatalf("Some expectations are already set for the SignatureHolder.AsByteString method") 153 } 154 155 mmAsByteString.mock.funcAsByteString = f 156 return mmAsByteString.mock 157 } 158 159 // AsByteString implements SignatureHolder 160 func (mmAsByteString *SignatureHolderMock) AsByteString() (b1 longbits.ByteString) { 161 mm_atomic.AddUint64(&mmAsByteString.beforeAsByteStringCounter, 1) 162 defer mm_atomic.AddUint64(&mmAsByteString.afterAsByteStringCounter, 1) 163 164 if mmAsByteString.inspectFuncAsByteString != nil { 165 mmAsByteString.inspectFuncAsByteString() 166 } 167 168 if mmAsByteString.AsByteStringMock.defaultExpectation != nil { 169 mm_atomic.AddUint64(&mmAsByteString.AsByteStringMock.defaultExpectation.Counter, 1) 170 171 mm_results := mmAsByteString.AsByteStringMock.defaultExpectation.results 172 if mm_results == nil { 173 mmAsByteString.t.Fatal("No results are set for the SignatureHolderMock.AsByteString") 174 } 175 return (*mm_results).b1 176 } 177 if mmAsByteString.funcAsByteString != nil { 178 return mmAsByteString.funcAsByteString() 179 } 180 mmAsByteString.t.Fatalf("Unexpected call to SignatureHolderMock.AsByteString.") 181 return 182 } 183 184 // AsByteStringAfterCounter returns a count of finished SignatureHolderMock.AsByteString invocations 185 func (mmAsByteString *SignatureHolderMock) AsByteStringAfterCounter() uint64 { 186 return mm_atomic.LoadUint64(&mmAsByteString.afterAsByteStringCounter) 187 } 188 189 // AsByteStringBeforeCounter returns a count of SignatureHolderMock.AsByteString invocations 190 func (mmAsByteString *SignatureHolderMock) AsByteStringBeforeCounter() uint64 { 191 return mm_atomic.LoadUint64(&mmAsByteString.beforeAsByteStringCounter) 192 } 193 194 // MinimockAsByteStringDone returns true if the count of the AsByteString invocations corresponds 195 // the number of defined expectations 196 func (m *SignatureHolderMock) MinimockAsByteStringDone() bool { 197 for _, e := range m.AsByteStringMock.expectations { 198 if mm_atomic.LoadUint64(&e.Counter) < 1 { 199 return false 200 } 201 } 202 203 // if default expectation was set then invocations count should be greater than zero 204 if m.AsByteStringMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAsByteStringCounter) < 1 { 205 return false 206 } 207 // if func was set then invocations count should be greater than zero 208 if m.funcAsByteString != nil && mm_atomic.LoadUint64(&m.afterAsByteStringCounter) < 1 { 209 return false 210 } 211 return true 212 } 213 214 // MinimockAsByteStringInspect logs each unmet expectation 215 func (m *SignatureHolderMock) MinimockAsByteStringInspect() { 216 for _, e := range m.AsByteStringMock.expectations { 217 if mm_atomic.LoadUint64(&e.Counter) < 1 { 218 m.t.Error("Expected call to SignatureHolderMock.AsByteString") 219 } 220 } 221 222 // if default expectation was set then invocations count should be greater than zero 223 if m.AsByteStringMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAsByteStringCounter) < 1 { 224 m.t.Error("Expected call to SignatureHolderMock.AsByteString") 225 } 226 // if func was set then invocations count should be greater than zero 227 if m.funcAsByteString != nil && mm_atomic.LoadUint64(&m.afterAsByteStringCounter) < 1 { 228 m.t.Error("Expected call to SignatureHolderMock.AsByteString") 229 } 230 } 231 232 type mSignatureHolderMockCopyTo struct { 233 mock *SignatureHolderMock 234 defaultExpectation *SignatureHolderMockCopyToExpectation 235 expectations []*SignatureHolderMockCopyToExpectation 236 237 callArgs []*SignatureHolderMockCopyToParams 238 mutex sync.RWMutex 239 } 240 241 // SignatureHolderMockCopyToExpectation specifies expectation struct of the SignatureHolder.CopyTo 242 type SignatureHolderMockCopyToExpectation struct { 243 mock *SignatureHolderMock 244 params *SignatureHolderMockCopyToParams 245 results *SignatureHolderMockCopyToResults 246 Counter uint64 247 } 248 249 // SignatureHolderMockCopyToParams contains parameters of the SignatureHolder.CopyTo 250 type SignatureHolderMockCopyToParams struct { 251 p []byte 252 } 253 254 // SignatureHolderMockCopyToResults contains results of the SignatureHolder.CopyTo 255 type SignatureHolderMockCopyToResults struct { 256 i1 int 257 } 258 259 // Expect sets up expected params for SignatureHolder.CopyTo 260 func (mmCopyTo *mSignatureHolderMockCopyTo) Expect(p []byte) *mSignatureHolderMockCopyTo { 261 if mmCopyTo.mock.funcCopyTo != nil { 262 mmCopyTo.mock.t.Fatalf("SignatureHolderMock.CopyTo mock is already set by Set") 263 } 264 265 if mmCopyTo.defaultExpectation == nil { 266 mmCopyTo.defaultExpectation = &SignatureHolderMockCopyToExpectation{} 267 } 268 269 mmCopyTo.defaultExpectation.params = &SignatureHolderMockCopyToParams{p} 270 for _, e := range mmCopyTo.expectations { 271 if minimock.Equal(e.params, mmCopyTo.defaultExpectation.params) { 272 mmCopyTo.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCopyTo.defaultExpectation.params) 273 } 274 } 275 276 return mmCopyTo 277 } 278 279 // Inspect accepts an inspector function that has same arguments as the SignatureHolder.CopyTo 280 func (mmCopyTo *mSignatureHolderMockCopyTo) Inspect(f func(p []byte)) *mSignatureHolderMockCopyTo { 281 if mmCopyTo.mock.inspectFuncCopyTo != nil { 282 mmCopyTo.mock.t.Fatalf("Inspect function is already set for SignatureHolderMock.CopyTo") 283 } 284 285 mmCopyTo.mock.inspectFuncCopyTo = f 286 287 return mmCopyTo 288 } 289 290 // Return sets up results that will be returned by SignatureHolder.CopyTo 291 func (mmCopyTo *mSignatureHolderMockCopyTo) Return(i1 int) *SignatureHolderMock { 292 if mmCopyTo.mock.funcCopyTo != nil { 293 mmCopyTo.mock.t.Fatalf("SignatureHolderMock.CopyTo mock is already set by Set") 294 } 295 296 if mmCopyTo.defaultExpectation == nil { 297 mmCopyTo.defaultExpectation = &SignatureHolderMockCopyToExpectation{mock: mmCopyTo.mock} 298 } 299 mmCopyTo.defaultExpectation.results = &SignatureHolderMockCopyToResults{i1} 300 return mmCopyTo.mock 301 } 302 303 //Set uses given function f to mock the SignatureHolder.CopyTo method 304 func (mmCopyTo *mSignatureHolderMockCopyTo) Set(f func(p []byte) (i1 int)) *SignatureHolderMock { 305 if mmCopyTo.defaultExpectation != nil { 306 mmCopyTo.mock.t.Fatalf("Default expectation is already set for the SignatureHolder.CopyTo method") 307 } 308 309 if len(mmCopyTo.expectations) > 0 { 310 mmCopyTo.mock.t.Fatalf("Some expectations are already set for the SignatureHolder.CopyTo method") 311 } 312 313 mmCopyTo.mock.funcCopyTo = f 314 return mmCopyTo.mock 315 } 316 317 // When sets expectation for the SignatureHolder.CopyTo which will trigger the result defined by the following 318 // Then helper 319 func (mmCopyTo *mSignatureHolderMockCopyTo) When(p []byte) *SignatureHolderMockCopyToExpectation { 320 if mmCopyTo.mock.funcCopyTo != nil { 321 mmCopyTo.mock.t.Fatalf("SignatureHolderMock.CopyTo mock is already set by Set") 322 } 323 324 expectation := &SignatureHolderMockCopyToExpectation{ 325 mock: mmCopyTo.mock, 326 params: &SignatureHolderMockCopyToParams{p}, 327 } 328 mmCopyTo.expectations = append(mmCopyTo.expectations, expectation) 329 return expectation 330 } 331 332 // Then sets up SignatureHolder.CopyTo return parameters for the expectation previously defined by the When method 333 func (e *SignatureHolderMockCopyToExpectation) Then(i1 int) *SignatureHolderMock { 334 e.results = &SignatureHolderMockCopyToResults{i1} 335 return e.mock 336 } 337 338 // CopyTo implements SignatureHolder 339 func (mmCopyTo *SignatureHolderMock) CopyTo(p []byte) (i1 int) { 340 mm_atomic.AddUint64(&mmCopyTo.beforeCopyToCounter, 1) 341 defer mm_atomic.AddUint64(&mmCopyTo.afterCopyToCounter, 1) 342 343 if mmCopyTo.inspectFuncCopyTo != nil { 344 mmCopyTo.inspectFuncCopyTo(p) 345 } 346 347 mm_params := &SignatureHolderMockCopyToParams{p} 348 349 // Record call args 350 mmCopyTo.CopyToMock.mutex.Lock() 351 mmCopyTo.CopyToMock.callArgs = append(mmCopyTo.CopyToMock.callArgs, mm_params) 352 mmCopyTo.CopyToMock.mutex.Unlock() 353 354 for _, e := range mmCopyTo.CopyToMock.expectations { 355 if minimock.Equal(e.params, mm_params) { 356 mm_atomic.AddUint64(&e.Counter, 1) 357 return e.results.i1 358 } 359 } 360 361 if mmCopyTo.CopyToMock.defaultExpectation != nil { 362 mm_atomic.AddUint64(&mmCopyTo.CopyToMock.defaultExpectation.Counter, 1) 363 mm_want := mmCopyTo.CopyToMock.defaultExpectation.params 364 mm_got := SignatureHolderMockCopyToParams{p} 365 if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { 366 mmCopyTo.t.Errorf("SignatureHolderMock.CopyTo got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) 367 } 368 369 mm_results := mmCopyTo.CopyToMock.defaultExpectation.results 370 if mm_results == nil { 371 mmCopyTo.t.Fatal("No results are set for the SignatureHolderMock.CopyTo") 372 } 373 return (*mm_results).i1 374 } 375 if mmCopyTo.funcCopyTo != nil { 376 return mmCopyTo.funcCopyTo(p) 377 } 378 mmCopyTo.t.Fatalf("Unexpected call to SignatureHolderMock.CopyTo. %v", p) 379 return 380 } 381 382 // CopyToAfterCounter returns a count of finished SignatureHolderMock.CopyTo invocations 383 func (mmCopyTo *SignatureHolderMock) CopyToAfterCounter() uint64 { 384 return mm_atomic.LoadUint64(&mmCopyTo.afterCopyToCounter) 385 } 386 387 // CopyToBeforeCounter returns a count of SignatureHolderMock.CopyTo invocations 388 func (mmCopyTo *SignatureHolderMock) CopyToBeforeCounter() uint64 { 389 return mm_atomic.LoadUint64(&mmCopyTo.beforeCopyToCounter) 390 } 391 392 // Calls returns a list of arguments used in each call to SignatureHolderMock.CopyTo. 393 // The list is in the same order as the calls were made (i.e. recent calls have a higher index) 394 func (mmCopyTo *mSignatureHolderMockCopyTo) Calls() []*SignatureHolderMockCopyToParams { 395 mmCopyTo.mutex.RLock() 396 397 argCopy := make([]*SignatureHolderMockCopyToParams, len(mmCopyTo.callArgs)) 398 copy(argCopy, mmCopyTo.callArgs) 399 400 mmCopyTo.mutex.RUnlock() 401 402 return argCopy 403 } 404 405 // MinimockCopyToDone returns true if the count of the CopyTo invocations corresponds 406 // the number of defined expectations 407 func (m *SignatureHolderMock) MinimockCopyToDone() bool { 408 for _, e := range m.CopyToMock.expectations { 409 if mm_atomic.LoadUint64(&e.Counter) < 1 { 410 return false 411 } 412 } 413 414 // if default expectation was set then invocations count should be greater than zero 415 if m.CopyToMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCopyToCounter) < 1 { 416 return false 417 } 418 // if func was set then invocations count should be greater than zero 419 if m.funcCopyTo != nil && mm_atomic.LoadUint64(&m.afterCopyToCounter) < 1 { 420 return false 421 } 422 return true 423 } 424 425 // MinimockCopyToInspect logs each unmet expectation 426 func (m *SignatureHolderMock) MinimockCopyToInspect() { 427 for _, e := range m.CopyToMock.expectations { 428 if mm_atomic.LoadUint64(&e.Counter) < 1 { 429 m.t.Errorf("Expected call to SignatureHolderMock.CopyTo with params: %#v", *e.params) 430 } 431 } 432 433 // if default expectation was set then invocations count should be greater than zero 434 if m.CopyToMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCopyToCounter) < 1 { 435 if m.CopyToMock.defaultExpectation.params == nil { 436 m.t.Error("Expected call to SignatureHolderMock.CopyTo") 437 } else { 438 m.t.Errorf("Expected call to SignatureHolderMock.CopyTo with params: %#v", *m.CopyToMock.defaultExpectation.params) 439 } 440 } 441 // if func was set then invocations count should be greater than zero 442 if m.funcCopyTo != nil && mm_atomic.LoadUint64(&m.afterCopyToCounter) < 1 { 443 m.t.Error("Expected call to SignatureHolderMock.CopyTo") 444 } 445 } 446 447 type mSignatureHolderMockEquals struct { 448 mock *SignatureHolderMock 449 defaultExpectation *SignatureHolderMockEqualsExpectation 450 expectations []*SignatureHolderMockEqualsExpectation 451 452 callArgs []*SignatureHolderMockEqualsParams 453 mutex sync.RWMutex 454 } 455 456 // SignatureHolderMockEqualsExpectation specifies expectation struct of the SignatureHolder.Equals 457 type SignatureHolderMockEqualsExpectation struct { 458 mock *SignatureHolderMock 459 params *SignatureHolderMockEqualsParams 460 results *SignatureHolderMockEqualsResults 461 Counter uint64 462 } 463 464 // SignatureHolderMockEqualsParams contains parameters of the SignatureHolder.Equals 465 type SignatureHolderMockEqualsParams struct { 466 other SignatureHolder 467 } 468 469 // SignatureHolderMockEqualsResults contains results of the SignatureHolder.Equals 470 type SignatureHolderMockEqualsResults struct { 471 b1 bool 472 } 473 474 // Expect sets up expected params for SignatureHolder.Equals 475 func (mmEquals *mSignatureHolderMockEquals) Expect(other SignatureHolder) *mSignatureHolderMockEquals { 476 if mmEquals.mock.funcEquals != nil { 477 mmEquals.mock.t.Fatalf("SignatureHolderMock.Equals mock is already set by Set") 478 } 479 480 if mmEquals.defaultExpectation == nil { 481 mmEquals.defaultExpectation = &SignatureHolderMockEqualsExpectation{} 482 } 483 484 mmEquals.defaultExpectation.params = &SignatureHolderMockEqualsParams{other} 485 for _, e := range mmEquals.expectations { 486 if minimock.Equal(e.params, mmEquals.defaultExpectation.params) { 487 mmEquals.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmEquals.defaultExpectation.params) 488 } 489 } 490 491 return mmEquals 492 } 493 494 // Inspect accepts an inspector function that has same arguments as the SignatureHolder.Equals 495 func (mmEquals *mSignatureHolderMockEquals) Inspect(f func(other SignatureHolder)) *mSignatureHolderMockEquals { 496 if mmEquals.mock.inspectFuncEquals != nil { 497 mmEquals.mock.t.Fatalf("Inspect function is already set for SignatureHolderMock.Equals") 498 } 499 500 mmEquals.mock.inspectFuncEquals = f 501 502 return mmEquals 503 } 504 505 // Return sets up results that will be returned by SignatureHolder.Equals 506 func (mmEquals *mSignatureHolderMockEquals) Return(b1 bool) *SignatureHolderMock { 507 if mmEquals.mock.funcEquals != nil { 508 mmEquals.mock.t.Fatalf("SignatureHolderMock.Equals mock is already set by Set") 509 } 510 511 if mmEquals.defaultExpectation == nil { 512 mmEquals.defaultExpectation = &SignatureHolderMockEqualsExpectation{mock: mmEquals.mock} 513 } 514 mmEquals.defaultExpectation.results = &SignatureHolderMockEqualsResults{b1} 515 return mmEquals.mock 516 } 517 518 //Set uses given function f to mock the SignatureHolder.Equals method 519 func (mmEquals *mSignatureHolderMockEquals) Set(f func(other SignatureHolder) (b1 bool)) *SignatureHolderMock { 520 if mmEquals.defaultExpectation != nil { 521 mmEquals.mock.t.Fatalf("Default expectation is already set for the SignatureHolder.Equals method") 522 } 523 524 if len(mmEquals.expectations) > 0 { 525 mmEquals.mock.t.Fatalf("Some expectations are already set for the SignatureHolder.Equals method") 526 } 527 528 mmEquals.mock.funcEquals = f 529 return mmEquals.mock 530 } 531 532 // When sets expectation for the SignatureHolder.Equals which will trigger the result defined by the following 533 // Then helper 534 func (mmEquals *mSignatureHolderMockEquals) When(other SignatureHolder) *SignatureHolderMockEqualsExpectation { 535 if mmEquals.mock.funcEquals != nil { 536 mmEquals.mock.t.Fatalf("SignatureHolderMock.Equals mock is already set by Set") 537 } 538 539 expectation := &SignatureHolderMockEqualsExpectation{ 540 mock: mmEquals.mock, 541 params: &SignatureHolderMockEqualsParams{other}, 542 } 543 mmEquals.expectations = append(mmEquals.expectations, expectation) 544 return expectation 545 } 546 547 // Then sets up SignatureHolder.Equals return parameters for the expectation previously defined by the When method 548 func (e *SignatureHolderMockEqualsExpectation) Then(b1 bool) *SignatureHolderMock { 549 e.results = &SignatureHolderMockEqualsResults{b1} 550 return e.mock 551 } 552 553 // Equals implements SignatureHolder 554 func (mmEquals *SignatureHolderMock) Equals(other SignatureHolder) (b1 bool) { 555 mm_atomic.AddUint64(&mmEquals.beforeEqualsCounter, 1) 556 defer mm_atomic.AddUint64(&mmEquals.afterEqualsCounter, 1) 557 558 if mmEquals.inspectFuncEquals != nil { 559 mmEquals.inspectFuncEquals(other) 560 } 561 562 mm_params := &SignatureHolderMockEqualsParams{other} 563 564 // Record call args 565 mmEquals.EqualsMock.mutex.Lock() 566 mmEquals.EqualsMock.callArgs = append(mmEquals.EqualsMock.callArgs, mm_params) 567 mmEquals.EqualsMock.mutex.Unlock() 568 569 for _, e := range mmEquals.EqualsMock.expectations { 570 if minimock.Equal(e.params, mm_params) { 571 mm_atomic.AddUint64(&e.Counter, 1) 572 return e.results.b1 573 } 574 } 575 576 if mmEquals.EqualsMock.defaultExpectation != nil { 577 mm_atomic.AddUint64(&mmEquals.EqualsMock.defaultExpectation.Counter, 1) 578 mm_want := mmEquals.EqualsMock.defaultExpectation.params 579 mm_got := SignatureHolderMockEqualsParams{other} 580 if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { 581 mmEquals.t.Errorf("SignatureHolderMock.Equals got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) 582 } 583 584 mm_results := mmEquals.EqualsMock.defaultExpectation.results 585 if mm_results == nil { 586 mmEquals.t.Fatal("No results are set for the SignatureHolderMock.Equals") 587 } 588 return (*mm_results).b1 589 } 590 if mmEquals.funcEquals != nil { 591 return mmEquals.funcEquals(other) 592 } 593 mmEquals.t.Fatalf("Unexpected call to SignatureHolderMock.Equals. %v", other) 594 return 595 } 596 597 // EqualsAfterCounter returns a count of finished SignatureHolderMock.Equals invocations 598 func (mmEquals *SignatureHolderMock) EqualsAfterCounter() uint64 { 599 return mm_atomic.LoadUint64(&mmEquals.afterEqualsCounter) 600 } 601 602 // EqualsBeforeCounter returns a count of SignatureHolderMock.Equals invocations 603 func (mmEquals *SignatureHolderMock) EqualsBeforeCounter() uint64 { 604 return mm_atomic.LoadUint64(&mmEquals.beforeEqualsCounter) 605 } 606 607 // Calls returns a list of arguments used in each call to SignatureHolderMock.Equals. 608 // The list is in the same order as the calls were made (i.e. recent calls have a higher index) 609 func (mmEquals *mSignatureHolderMockEquals) Calls() []*SignatureHolderMockEqualsParams { 610 mmEquals.mutex.RLock() 611 612 argCopy := make([]*SignatureHolderMockEqualsParams, len(mmEquals.callArgs)) 613 copy(argCopy, mmEquals.callArgs) 614 615 mmEquals.mutex.RUnlock() 616 617 return argCopy 618 } 619 620 // MinimockEqualsDone returns true if the count of the Equals invocations corresponds 621 // the number of defined expectations 622 func (m *SignatureHolderMock) MinimockEqualsDone() bool { 623 for _, e := range m.EqualsMock.expectations { 624 if mm_atomic.LoadUint64(&e.Counter) < 1 { 625 return false 626 } 627 } 628 629 // if default expectation was set then invocations count should be greater than zero 630 if m.EqualsMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterEqualsCounter) < 1 { 631 return false 632 } 633 // if func was set then invocations count should be greater than zero 634 if m.funcEquals != nil && mm_atomic.LoadUint64(&m.afterEqualsCounter) < 1 { 635 return false 636 } 637 return true 638 } 639 640 // MinimockEqualsInspect logs each unmet expectation 641 func (m *SignatureHolderMock) MinimockEqualsInspect() { 642 for _, e := range m.EqualsMock.expectations { 643 if mm_atomic.LoadUint64(&e.Counter) < 1 { 644 m.t.Errorf("Expected call to SignatureHolderMock.Equals with params: %#v", *e.params) 645 } 646 } 647 648 // if default expectation was set then invocations count should be greater than zero 649 if m.EqualsMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterEqualsCounter) < 1 { 650 if m.EqualsMock.defaultExpectation.params == nil { 651 m.t.Error("Expected call to SignatureHolderMock.Equals") 652 } else { 653 m.t.Errorf("Expected call to SignatureHolderMock.Equals with params: %#v", *m.EqualsMock.defaultExpectation.params) 654 } 655 } 656 // if func was set then invocations count should be greater than zero 657 if m.funcEquals != nil && mm_atomic.LoadUint64(&m.afterEqualsCounter) < 1 { 658 m.t.Error("Expected call to SignatureHolderMock.Equals") 659 } 660 } 661 662 type mSignatureHolderMockFixedByteSize struct { 663 mock *SignatureHolderMock 664 defaultExpectation *SignatureHolderMockFixedByteSizeExpectation 665 expectations []*SignatureHolderMockFixedByteSizeExpectation 666 } 667 668 // SignatureHolderMockFixedByteSizeExpectation specifies expectation struct of the SignatureHolder.FixedByteSize 669 type SignatureHolderMockFixedByteSizeExpectation struct { 670 mock *SignatureHolderMock 671 672 results *SignatureHolderMockFixedByteSizeResults 673 Counter uint64 674 } 675 676 // SignatureHolderMockFixedByteSizeResults contains results of the SignatureHolder.FixedByteSize 677 type SignatureHolderMockFixedByteSizeResults struct { 678 i1 int 679 } 680 681 // Expect sets up expected params for SignatureHolder.FixedByteSize 682 func (mmFixedByteSize *mSignatureHolderMockFixedByteSize) Expect() *mSignatureHolderMockFixedByteSize { 683 if mmFixedByteSize.mock.funcFixedByteSize != nil { 684 mmFixedByteSize.mock.t.Fatalf("SignatureHolderMock.FixedByteSize mock is already set by Set") 685 } 686 687 if mmFixedByteSize.defaultExpectation == nil { 688 mmFixedByteSize.defaultExpectation = &SignatureHolderMockFixedByteSizeExpectation{} 689 } 690 691 return mmFixedByteSize 692 } 693 694 // Inspect accepts an inspector function that has same arguments as the SignatureHolder.FixedByteSize 695 func (mmFixedByteSize *mSignatureHolderMockFixedByteSize) Inspect(f func()) *mSignatureHolderMockFixedByteSize { 696 if mmFixedByteSize.mock.inspectFuncFixedByteSize != nil { 697 mmFixedByteSize.mock.t.Fatalf("Inspect function is already set for SignatureHolderMock.FixedByteSize") 698 } 699 700 mmFixedByteSize.mock.inspectFuncFixedByteSize = f 701 702 return mmFixedByteSize 703 } 704 705 // Return sets up results that will be returned by SignatureHolder.FixedByteSize 706 func (mmFixedByteSize *mSignatureHolderMockFixedByteSize) Return(i1 int) *SignatureHolderMock { 707 if mmFixedByteSize.mock.funcFixedByteSize != nil { 708 mmFixedByteSize.mock.t.Fatalf("SignatureHolderMock.FixedByteSize mock is already set by Set") 709 } 710 711 if mmFixedByteSize.defaultExpectation == nil { 712 mmFixedByteSize.defaultExpectation = &SignatureHolderMockFixedByteSizeExpectation{mock: mmFixedByteSize.mock} 713 } 714 mmFixedByteSize.defaultExpectation.results = &SignatureHolderMockFixedByteSizeResults{i1} 715 return mmFixedByteSize.mock 716 } 717 718 //Set uses given function f to mock the SignatureHolder.FixedByteSize method 719 func (mmFixedByteSize *mSignatureHolderMockFixedByteSize) Set(f func() (i1 int)) *SignatureHolderMock { 720 if mmFixedByteSize.defaultExpectation != nil { 721 mmFixedByteSize.mock.t.Fatalf("Default expectation is already set for the SignatureHolder.FixedByteSize method") 722 } 723 724 if len(mmFixedByteSize.expectations) > 0 { 725 mmFixedByteSize.mock.t.Fatalf("Some expectations are already set for the SignatureHolder.FixedByteSize method") 726 } 727 728 mmFixedByteSize.mock.funcFixedByteSize = f 729 return mmFixedByteSize.mock 730 } 731 732 // FixedByteSize implements SignatureHolder 733 func (mmFixedByteSize *SignatureHolderMock) FixedByteSize() (i1 int) { 734 mm_atomic.AddUint64(&mmFixedByteSize.beforeFixedByteSizeCounter, 1) 735 defer mm_atomic.AddUint64(&mmFixedByteSize.afterFixedByteSizeCounter, 1) 736 737 if mmFixedByteSize.inspectFuncFixedByteSize != nil { 738 mmFixedByteSize.inspectFuncFixedByteSize() 739 } 740 741 if mmFixedByteSize.FixedByteSizeMock.defaultExpectation != nil { 742 mm_atomic.AddUint64(&mmFixedByteSize.FixedByteSizeMock.defaultExpectation.Counter, 1) 743 744 mm_results := mmFixedByteSize.FixedByteSizeMock.defaultExpectation.results 745 if mm_results == nil { 746 mmFixedByteSize.t.Fatal("No results are set for the SignatureHolderMock.FixedByteSize") 747 } 748 return (*mm_results).i1 749 } 750 if mmFixedByteSize.funcFixedByteSize != nil { 751 return mmFixedByteSize.funcFixedByteSize() 752 } 753 mmFixedByteSize.t.Fatalf("Unexpected call to SignatureHolderMock.FixedByteSize.") 754 return 755 } 756 757 // FixedByteSizeAfterCounter returns a count of finished SignatureHolderMock.FixedByteSize invocations 758 func (mmFixedByteSize *SignatureHolderMock) FixedByteSizeAfterCounter() uint64 { 759 return mm_atomic.LoadUint64(&mmFixedByteSize.afterFixedByteSizeCounter) 760 } 761 762 // FixedByteSizeBeforeCounter returns a count of SignatureHolderMock.FixedByteSize invocations 763 func (mmFixedByteSize *SignatureHolderMock) FixedByteSizeBeforeCounter() uint64 { 764 return mm_atomic.LoadUint64(&mmFixedByteSize.beforeFixedByteSizeCounter) 765 } 766 767 // MinimockFixedByteSizeDone returns true if the count of the FixedByteSize invocations corresponds 768 // the number of defined expectations 769 func (m *SignatureHolderMock) MinimockFixedByteSizeDone() bool { 770 for _, e := range m.FixedByteSizeMock.expectations { 771 if mm_atomic.LoadUint64(&e.Counter) < 1 { 772 return false 773 } 774 } 775 776 // if default expectation was set then invocations count should be greater than zero 777 if m.FixedByteSizeMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterFixedByteSizeCounter) < 1 { 778 return false 779 } 780 // if func was set then invocations count should be greater than zero 781 if m.funcFixedByteSize != nil && mm_atomic.LoadUint64(&m.afterFixedByteSizeCounter) < 1 { 782 return false 783 } 784 return true 785 } 786 787 // MinimockFixedByteSizeInspect logs each unmet expectation 788 func (m *SignatureHolderMock) MinimockFixedByteSizeInspect() { 789 for _, e := range m.FixedByteSizeMock.expectations { 790 if mm_atomic.LoadUint64(&e.Counter) < 1 { 791 m.t.Error("Expected call to SignatureHolderMock.FixedByteSize") 792 } 793 } 794 795 // if default expectation was set then invocations count should be greater than zero 796 if m.FixedByteSizeMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterFixedByteSizeCounter) < 1 { 797 m.t.Error("Expected call to SignatureHolderMock.FixedByteSize") 798 } 799 // if func was set then invocations count should be greater than zero 800 if m.funcFixedByteSize != nil && mm_atomic.LoadUint64(&m.afterFixedByteSizeCounter) < 1 { 801 m.t.Error("Expected call to SignatureHolderMock.FixedByteSize") 802 } 803 } 804 805 type mSignatureHolderMockFoldToUint64 struct { 806 mock *SignatureHolderMock 807 defaultExpectation *SignatureHolderMockFoldToUint64Expectation 808 expectations []*SignatureHolderMockFoldToUint64Expectation 809 } 810 811 // SignatureHolderMockFoldToUint64Expectation specifies expectation struct of the SignatureHolder.FoldToUint64 812 type SignatureHolderMockFoldToUint64Expectation struct { 813 mock *SignatureHolderMock 814 815 results *SignatureHolderMockFoldToUint64Results 816 Counter uint64 817 } 818 819 // SignatureHolderMockFoldToUint64Results contains results of the SignatureHolder.FoldToUint64 820 type SignatureHolderMockFoldToUint64Results struct { 821 u1 uint64 822 } 823 824 // Expect sets up expected params for SignatureHolder.FoldToUint64 825 func (mmFoldToUint64 *mSignatureHolderMockFoldToUint64) Expect() *mSignatureHolderMockFoldToUint64 { 826 if mmFoldToUint64.mock.funcFoldToUint64 != nil { 827 mmFoldToUint64.mock.t.Fatalf("SignatureHolderMock.FoldToUint64 mock is already set by Set") 828 } 829 830 if mmFoldToUint64.defaultExpectation == nil { 831 mmFoldToUint64.defaultExpectation = &SignatureHolderMockFoldToUint64Expectation{} 832 } 833 834 return mmFoldToUint64 835 } 836 837 // Inspect accepts an inspector function that has same arguments as the SignatureHolder.FoldToUint64 838 func (mmFoldToUint64 *mSignatureHolderMockFoldToUint64) Inspect(f func()) *mSignatureHolderMockFoldToUint64 { 839 if mmFoldToUint64.mock.inspectFuncFoldToUint64 != nil { 840 mmFoldToUint64.mock.t.Fatalf("Inspect function is already set for SignatureHolderMock.FoldToUint64") 841 } 842 843 mmFoldToUint64.mock.inspectFuncFoldToUint64 = f 844 845 return mmFoldToUint64 846 } 847 848 // Return sets up results that will be returned by SignatureHolder.FoldToUint64 849 func (mmFoldToUint64 *mSignatureHolderMockFoldToUint64) Return(u1 uint64) *SignatureHolderMock { 850 if mmFoldToUint64.mock.funcFoldToUint64 != nil { 851 mmFoldToUint64.mock.t.Fatalf("SignatureHolderMock.FoldToUint64 mock is already set by Set") 852 } 853 854 if mmFoldToUint64.defaultExpectation == nil { 855 mmFoldToUint64.defaultExpectation = &SignatureHolderMockFoldToUint64Expectation{mock: mmFoldToUint64.mock} 856 } 857 mmFoldToUint64.defaultExpectation.results = &SignatureHolderMockFoldToUint64Results{u1} 858 return mmFoldToUint64.mock 859 } 860 861 //Set uses given function f to mock the SignatureHolder.FoldToUint64 method 862 func (mmFoldToUint64 *mSignatureHolderMockFoldToUint64) Set(f func() (u1 uint64)) *SignatureHolderMock { 863 if mmFoldToUint64.defaultExpectation != nil { 864 mmFoldToUint64.mock.t.Fatalf("Default expectation is already set for the SignatureHolder.FoldToUint64 method") 865 } 866 867 if len(mmFoldToUint64.expectations) > 0 { 868 mmFoldToUint64.mock.t.Fatalf("Some expectations are already set for the SignatureHolder.FoldToUint64 method") 869 } 870 871 mmFoldToUint64.mock.funcFoldToUint64 = f 872 return mmFoldToUint64.mock 873 } 874 875 // FoldToUint64 implements SignatureHolder 876 func (mmFoldToUint64 *SignatureHolderMock) FoldToUint64() (u1 uint64) { 877 mm_atomic.AddUint64(&mmFoldToUint64.beforeFoldToUint64Counter, 1) 878 defer mm_atomic.AddUint64(&mmFoldToUint64.afterFoldToUint64Counter, 1) 879 880 if mmFoldToUint64.inspectFuncFoldToUint64 != nil { 881 mmFoldToUint64.inspectFuncFoldToUint64() 882 } 883 884 if mmFoldToUint64.FoldToUint64Mock.defaultExpectation != nil { 885 mm_atomic.AddUint64(&mmFoldToUint64.FoldToUint64Mock.defaultExpectation.Counter, 1) 886 887 mm_results := mmFoldToUint64.FoldToUint64Mock.defaultExpectation.results 888 if mm_results == nil { 889 mmFoldToUint64.t.Fatal("No results are set for the SignatureHolderMock.FoldToUint64") 890 } 891 return (*mm_results).u1 892 } 893 if mmFoldToUint64.funcFoldToUint64 != nil { 894 return mmFoldToUint64.funcFoldToUint64() 895 } 896 mmFoldToUint64.t.Fatalf("Unexpected call to SignatureHolderMock.FoldToUint64.") 897 return 898 } 899 900 // FoldToUint64AfterCounter returns a count of finished SignatureHolderMock.FoldToUint64 invocations 901 func (mmFoldToUint64 *SignatureHolderMock) FoldToUint64AfterCounter() uint64 { 902 return mm_atomic.LoadUint64(&mmFoldToUint64.afterFoldToUint64Counter) 903 } 904 905 // FoldToUint64BeforeCounter returns a count of SignatureHolderMock.FoldToUint64 invocations 906 func (mmFoldToUint64 *SignatureHolderMock) FoldToUint64BeforeCounter() uint64 { 907 return mm_atomic.LoadUint64(&mmFoldToUint64.beforeFoldToUint64Counter) 908 } 909 910 // MinimockFoldToUint64Done returns true if the count of the FoldToUint64 invocations corresponds 911 // the number of defined expectations 912 func (m *SignatureHolderMock) MinimockFoldToUint64Done() bool { 913 for _, e := range m.FoldToUint64Mock.expectations { 914 if mm_atomic.LoadUint64(&e.Counter) < 1 { 915 return false 916 } 917 } 918 919 // if default expectation was set then invocations count should be greater than zero 920 if m.FoldToUint64Mock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterFoldToUint64Counter) < 1 { 921 return false 922 } 923 // if func was set then invocations count should be greater than zero 924 if m.funcFoldToUint64 != nil && mm_atomic.LoadUint64(&m.afterFoldToUint64Counter) < 1 { 925 return false 926 } 927 return true 928 } 929 930 // MinimockFoldToUint64Inspect logs each unmet expectation 931 func (m *SignatureHolderMock) MinimockFoldToUint64Inspect() { 932 for _, e := range m.FoldToUint64Mock.expectations { 933 if mm_atomic.LoadUint64(&e.Counter) < 1 { 934 m.t.Error("Expected call to SignatureHolderMock.FoldToUint64") 935 } 936 } 937 938 // if default expectation was set then invocations count should be greater than zero 939 if m.FoldToUint64Mock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterFoldToUint64Counter) < 1 { 940 m.t.Error("Expected call to SignatureHolderMock.FoldToUint64") 941 } 942 // if func was set then invocations count should be greater than zero 943 if m.funcFoldToUint64 != nil && mm_atomic.LoadUint64(&m.afterFoldToUint64Counter) < 1 { 944 m.t.Error("Expected call to SignatureHolderMock.FoldToUint64") 945 } 946 } 947 948 type mSignatureHolderMockGetSignatureMethod struct { 949 mock *SignatureHolderMock 950 defaultExpectation *SignatureHolderMockGetSignatureMethodExpectation 951 expectations []*SignatureHolderMockGetSignatureMethodExpectation 952 } 953 954 // SignatureHolderMockGetSignatureMethodExpectation specifies expectation struct of the SignatureHolder.GetSignatureMethod 955 type SignatureHolderMockGetSignatureMethodExpectation struct { 956 mock *SignatureHolderMock 957 958 results *SignatureHolderMockGetSignatureMethodResults 959 Counter uint64 960 } 961 962 // SignatureHolderMockGetSignatureMethodResults contains results of the SignatureHolder.GetSignatureMethod 963 type SignatureHolderMockGetSignatureMethodResults struct { 964 s1 SignatureMethod 965 } 966 967 // Expect sets up expected params for SignatureHolder.GetSignatureMethod 968 func (mmGetSignatureMethod *mSignatureHolderMockGetSignatureMethod) Expect() *mSignatureHolderMockGetSignatureMethod { 969 if mmGetSignatureMethod.mock.funcGetSignatureMethod != nil { 970 mmGetSignatureMethod.mock.t.Fatalf("SignatureHolderMock.GetSignatureMethod mock is already set by Set") 971 } 972 973 if mmGetSignatureMethod.defaultExpectation == nil { 974 mmGetSignatureMethod.defaultExpectation = &SignatureHolderMockGetSignatureMethodExpectation{} 975 } 976 977 return mmGetSignatureMethod 978 } 979 980 // Inspect accepts an inspector function that has same arguments as the SignatureHolder.GetSignatureMethod 981 func (mmGetSignatureMethod *mSignatureHolderMockGetSignatureMethod) Inspect(f func()) *mSignatureHolderMockGetSignatureMethod { 982 if mmGetSignatureMethod.mock.inspectFuncGetSignatureMethod != nil { 983 mmGetSignatureMethod.mock.t.Fatalf("Inspect function is already set for SignatureHolderMock.GetSignatureMethod") 984 } 985 986 mmGetSignatureMethod.mock.inspectFuncGetSignatureMethod = f 987 988 return mmGetSignatureMethod 989 } 990 991 // Return sets up results that will be returned by SignatureHolder.GetSignatureMethod 992 func (mmGetSignatureMethod *mSignatureHolderMockGetSignatureMethod) Return(s1 SignatureMethod) *SignatureHolderMock { 993 if mmGetSignatureMethod.mock.funcGetSignatureMethod != nil { 994 mmGetSignatureMethod.mock.t.Fatalf("SignatureHolderMock.GetSignatureMethod mock is already set by Set") 995 } 996 997 if mmGetSignatureMethod.defaultExpectation == nil { 998 mmGetSignatureMethod.defaultExpectation = &SignatureHolderMockGetSignatureMethodExpectation{mock: mmGetSignatureMethod.mock} 999 } 1000 mmGetSignatureMethod.defaultExpectation.results = &SignatureHolderMockGetSignatureMethodResults{s1} 1001 return mmGetSignatureMethod.mock 1002 } 1003 1004 //Set uses given function f to mock the SignatureHolder.GetSignatureMethod method 1005 func (mmGetSignatureMethod *mSignatureHolderMockGetSignatureMethod) Set(f func() (s1 SignatureMethod)) *SignatureHolderMock { 1006 if mmGetSignatureMethod.defaultExpectation != nil { 1007 mmGetSignatureMethod.mock.t.Fatalf("Default expectation is already set for the SignatureHolder.GetSignatureMethod method") 1008 } 1009 1010 if len(mmGetSignatureMethod.expectations) > 0 { 1011 mmGetSignatureMethod.mock.t.Fatalf("Some expectations are already set for the SignatureHolder.GetSignatureMethod method") 1012 } 1013 1014 mmGetSignatureMethod.mock.funcGetSignatureMethod = f 1015 return mmGetSignatureMethod.mock 1016 } 1017 1018 // GetSignatureMethod implements SignatureHolder 1019 func (mmGetSignatureMethod *SignatureHolderMock) GetSignatureMethod() (s1 SignatureMethod) { 1020 mm_atomic.AddUint64(&mmGetSignatureMethod.beforeGetSignatureMethodCounter, 1) 1021 defer mm_atomic.AddUint64(&mmGetSignatureMethod.afterGetSignatureMethodCounter, 1) 1022 1023 if mmGetSignatureMethod.inspectFuncGetSignatureMethod != nil { 1024 mmGetSignatureMethod.inspectFuncGetSignatureMethod() 1025 } 1026 1027 if mmGetSignatureMethod.GetSignatureMethodMock.defaultExpectation != nil { 1028 mm_atomic.AddUint64(&mmGetSignatureMethod.GetSignatureMethodMock.defaultExpectation.Counter, 1) 1029 1030 mm_results := mmGetSignatureMethod.GetSignatureMethodMock.defaultExpectation.results 1031 if mm_results == nil { 1032 mmGetSignatureMethod.t.Fatal("No results are set for the SignatureHolderMock.GetSignatureMethod") 1033 } 1034 return (*mm_results).s1 1035 } 1036 if mmGetSignatureMethod.funcGetSignatureMethod != nil { 1037 return mmGetSignatureMethod.funcGetSignatureMethod() 1038 } 1039 mmGetSignatureMethod.t.Fatalf("Unexpected call to SignatureHolderMock.GetSignatureMethod.") 1040 return 1041 } 1042 1043 // GetSignatureMethodAfterCounter returns a count of finished SignatureHolderMock.GetSignatureMethod invocations 1044 func (mmGetSignatureMethod *SignatureHolderMock) GetSignatureMethodAfterCounter() uint64 { 1045 return mm_atomic.LoadUint64(&mmGetSignatureMethod.afterGetSignatureMethodCounter) 1046 } 1047 1048 // GetSignatureMethodBeforeCounter returns a count of SignatureHolderMock.GetSignatureMethod invocations 1049 func (mmGetSignatureMethod *SignatureHolderMock) GetSignatureMethodBeforeCounter() uint64 { 1050 return mm_atomic.LoadUint64(&mmGetSignatureMethod.beforeGetSignatureMethodCounter) 1051 } 1052 1053 // MinimockGetSignatureMethodDone returns true if the count of the GetSignatureMethod invocations corresponds 1054 // the number of defined expectations 1055 func (m *SignatureHolderMock) MinimockGetSignatureMethodDone() bool { 1056 for _, e := range m.GetSignatureMethodMock.expectations { 1057 if mm_atomic.LoadUint64(&e.Counter) < 1 { 1058 return false 1059 } 1060 } 1061 1062 // if default expectation was set then invocations count should be greater than zero 1063 if m.GetSignatureMethodMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetSignatureMethodCounter) < 1 { 1064 return false 1065 } 1066 // if func was set then invocations count should be greater than zero 1067 if m.funcGetSignatureMethod != nil && mm_atomic.LoadUint64(&m.afterGetSignatureMethodCounter) < 1 { 1068 return false 1069 } 1070 return true 1071 } 1072 1073 // MinimockGetSignatureMethodInspect logs each unmet expectation 1074 func (m *SignatureHolderMock) MinimockGetSignatureMethodInspect() { 1075 for _, e := range m.GetSignatureMethodMock.expectations { 1076 if mm_atomic.LoadUint64(&e.Counter) < 1 { 1077 m.t.Error("Expected call to SignatureHolderMock.GetSignatureMethod") 1078 } 1079 } 1080 1081 // if default expectation was set then invocations count should be greater than zero 1082 if m.GetSignatureMethodMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetSignatureMethodCounter) < 1 { 1083 m.t.Error("Expected call to SignatureHolderMock.GetSignatureMethod") 1084 } 1085 // if func was set then invocations count should be greater than zero 1086 if m.funcGetSignatureMethod != nil && mm_atomic.LoadUint64(&m.afterGetSignatureMethodCounter) < 1 { 1087 m.t.Error("Expected call to SignatureHolderMock.GetSignatureMethod") 1088 } 1089 } 1090 1091 type mSignatureHolderMockWriteTo struct { 1092 mock *SignatureHolderMock 1093 defaultExpectation *SignatureHolderMockWriteToExpectation 1094 expectations []*SignatureHolderMockWriteToExpectation 1095 1096 callArgs []*SignatureHolderMockWriteToParams 1097 mutex sync.RWMutex 1098 } 1099 1100 // SignatureHolderMockWriteToExpectation specifies expectation struct of the SignatureHolder.WriteTo 1101 type SignatureHolderMockWriteToExpectation struct { 1102 mock *SignatureHolderMock 1103 params *SignatureHolderMockWriteToParams 1104 results *SignatureHolderMockWriteToResults 1105 Counter uint64 1106 } 1107 1108 // SignatureHolderMockWriteToParams contains parameters of the SignatureHolder.WriteTo 1109 type SignatureHolderMockWriteToParams struct { 1110 w io.Writer 1111 } 1112 1113 // SignatureHolderMockWriteToResults contains results of the SignatureHolder.WriteTo 1114 type SignatureHolderMockWriteToResults struct { 1115 n int64 1116 err error 1117 } 1118 1119 // Expect sets up expected params for SignatureHolder.WriteTo 1120 func (mmWriteTo *mSignatureHolderMockWriteTo) Expect(w io.Writer) *mSignatureHolderMockWriteTo { 1121 if mmWriteTo.mock.funcWriteTo != nil { 1122 mmWriteTo.mock.t.Fatalf("SignatureHolderMock.WriteTo mock is already set by Set") 1123 } 1124 1125 if mmWriteTo.defaultExpectation == nil { 1126 mmWriteTo.defaultExpectation = &SignatureHolderMockWriteToExpectation{} 1127 } 1128 1129 mmWriteTo.defaultExpectation.params = &SignatureHolderMockWriteToParams{w} 1130 for _, e := range mmWriteTo.expectations { 1131 if minimock.Equal(e.params, mmWriteTo.defaultExpectation.params) { 1132 mmWriteTo.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmWriteTo.defaultExpectation.params) 1133 } 1134 } 1135 1136 return mmWriteTo 1137 } 1138 1139 // Inspect accepts an inspector function that has same arguments as the SignatureHolder.WriteTo 1140 func (mmWriteTo *mSignatureHolderMockWriteTo) Inspect(f func(w io.Writer)) *mSignatureHolderMockWriteTo { 1141 if mmWriteTo.mock.inspectFuncWriteTo != nil { 1142 mmWriteTo.mock.t.Fatalf("Inspect function is already set for SignatureHolderMock.WriteTo") 1143 } 1144 1145 mmWriteTo.mock.inspectFuncWriteTo = f 1146 1147 return mmWriteTo 1148 } 1149 1150 // Return sets up results that will be returned by SignatureHolder.WriteTo 1151 func (mmWriteTo *mSignatureHolderMockWriteTo) Return(n int64, err error) *SignatureHolderMock { 1152 if mmWriteTo.mock.funcWriteTo != nil { 1153 mmWriteTo.mock.t.Fatalf("SignatureHolderMock.WriteTo mock is already set by Set") 1154 } 1155 1156 if mmWriteTo.defaultExpectation == nil { 1157 mmWriteTo.defaultExpectation = &SignatureHolderMockWriteToExpectation{mock: mmWriteTo.mock} 1158 } 1159 mmWriteTo.defaultExpectation.results = &SignatureHolderMockWriteToResults{n, err} 1160 return mmWriteTo.mock 1161 } 1162 1163 //Set uses given function f to mock the SignatureHolder.WriteTo method 1164 func (mmWriteTo *mSignatureHolderMockWriteTo) Set(f func(w io.Writer) (n int64, err error)) *SignatureHolderMock { 1165 if mmWriteTo.defaultExpectation != nil { 1166 mmWriteTo.mock.t.Fatalf("Default expectation is already set for the SignatureHolder.WriteTo method") 1167 } 1168 1169 if len(mmWriteTo.expectations) > 0 { 1170 mmWriteTo.mock.t.Fatalf("Some expectations are already set for the SignatureHolder.WriteTo method") 1171 } 1172 1173 mmWriteTo.mock.funcWriteTo = f 1174 return mmWriteTo.mock 1175 } 1176 1177 // When sets expectation for the SignatureHolder.WriteTo which will trigger the result defined by the following 1178 // Then helper 1179 func (mmWriteTo *mSignatureHolderMockWriteTo) When(w io.Writer) *SignatureHolderMockWriteToExpectation { 1180 if mmWriteTo.mock.funcWriteTo != nil { 1181 mmWriteTo.mock.t.Fatalf("SignatureHolderMock.WriteTo mock is already set by Set") 1182 } 1183 1184 expectation := &SignatureHolderMockWriteToExpectation{ 1185 mock: mmWriteTo.mock, 1186 params: &SignatureHolderMockWriteToParams{w}, 1187 } 1188 mmWriteTo.expectations = append(mmWriteTo.expectations, expectation) 1189 return expectation 1190 } 1191 1192 // Then sets up SignatureHolder.WriteTo return parameters for the expectation previously defined by the When method 1193 func (e *SignatureHolderMockWriteToExpectation) Then(n int64, err error) *SignatureHolderMock { 1194 e.results = &SignatureHolderMockWriteToResults{n, err} 1195 return e.mock 1196 } 1197 1198 // WriteTo implements SignatureHolder 1199 func (mmWriteTo *SignatureHolderMock) WriteTo(w io.Writer) (n int64, err error) { 1200 mm_atomic.AddUint64(&mmWriteTo.beforeWriteToCounter, 1) 1201 defer mm_atomic.AddUint64(&mmWriteTo.afterWriteToCounter, 1) 1202 1203 if mmWriteTo.inspectFuncWriteTo != nil { 1204 mmWriteTo.inspectFuncWriteTo(w) 1205 } 1206 1207 mm_params := &SignatureHolderMockWriteToParams{w} 1208 1209 // Record call args 1210 mmWriteTo.WriteToMock.mutex.Lock() 1211 mmWriteTo.WriteToMock.callArgs = append(mmWriteTo.WriteToMock.callArgs, mm_params) 1212 mmWriteTo.WriteToMock.mutex.Unlock() 1213 1214 for _, e := range mmWriteTo.WriteToMock.expectations { 1215 if minimock.Equal(e.params, mm_params) { 1216 mm_atomic.AddUint64(&e.Counter, 1) 1217 return e.results.n, e.results.err 1218 } 1219 } 1220 1221 if mmWriteTo.WriteToMock.defaultExpectation != nil { 1222 mm_atomic.AddUint64(&mmWriteTo.WriteToMock.defaultExpectation.Counter, 1) 1223 mm_want := mmWriteTo.WriteToMock.defaultExpectation.params 1224 mm_got := SignatureHolderMockWriteToParams{w} 1225 if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { 1226 mmWriteTo.t.Errorf("SignatureHolderMock.WriteTo got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) 1227 } 1228 1229 mm_results := mmWriteTo.WriteToMock.defaultExpectation.results 1230 if mm_results == nil { 1231 mmWriteTo.t.Fatal("No results are set for the SignatureHolderMock.WriteTo") 1232 } 1233 return (*mm_results).n, (*mm_results).err 1234 } 1235 if mmWriteTo.funcWriteTo != nil { 1236 return mmWriteTo.funcWriteTo(w) 1237 } 1238 mmWriteTo.t.Fatalf("Unexpected call to SignatureHolderMock.WriteTo. %v", w) 1239 return 1240 } 1241 1242 // WriteToAfterCounter returns a count of finished SignatureHolderMock.WriteTo invocations 1243 func (mmWriteTo *SignatureHolderMock) WriteToAfterCounter() uint64 { 1244 return mm_atomic.LoadUint64(&mmWriteTo.afterWriteToCounter) 1245 } 1246 1247 // WriteToBeforeCounter returns a count of SignatureHolderMock.WriteTo invocations 1248 func (mmWriteTo *SignatureHolderMock) WriteToBeforeCounter() uint64 { 1249 return mm_atomic.LoadUint64(&mmWriteTo.beforeWriteToCounter) 1250 } 1251 1252 // Calls returns a list of arguments used in each call to SignatureHolderMock.WriteTo. 1253 // The list is in the same order as the calls were made (i.e. recent calls have a higher index) 1254 func (mmWriteTo *mSignatureHolderMockWriteTo) Calls() []*SignatureHolderMockWriteToParams { 1255 mmWriteTo.mutex.RLock() 1256 1257 argCopy := make([]*SignatureHolderMockWriteToParams, len(mmWriteTo.callArgs)) 1258 copy(argCopy, mmWriteTo.callArgs) 1259 1260 mmWriteTo.mutex.RUnlock() 1261 1262 return argCopy 1263 } 1264 1265 // MinimockWriteToDone returns true if the count of the WriteTo invocations corresponds 1266 // the number of defined expectations 1267 func (m *SignatureHolderMock) MinimockWriteToDone() bool { 1268 for _, e := range m.WriteToMock.expectations { 1269 if mm_atomic.LoadUint64(&e.Counter) < 1 { 1270 return false 1271 } 1272 } 1273 1274 // if default expectation was set then invocations count should be greater than zero 1275 if m.WriteToMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterWriteToCounter) < 1 { 1276 return false 1277 } 1278 // if func was set then invocations count should be greater than zero 1279 if m.funcWriteTo != nil && mm_atomic.LoadUint64(&m.afterWriteToCounter) < 1 { 1280 return false 1281 } 1282 return true 1283 } 1284 1285 // MinimockWriteToInspect logs each unmet expectation 1286 func (m *SignatureHolderMock) MinimockWriteToInspect() { 1287 for _, e := range m.WriteToMock.expectations { 1288 if mm_atomic.LoadUint64(&e.Counter) < 1 { 1289 m.t.Errorf("Expected call to SignatureHolderMock.WriteTo with params: %#v", *e.params) 1290 } 1291 } 1292 1293 // if default expectation was set then invocations count should be greater than zero 1294 if m.WriteToMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterWriteToCounter) < 1 { 1295 if m.WriteToMock.defaultExpectation.params == nil { 1296 m.t.Error("Expected call to SignatureHolderMock.WriteTo") 1297 } else { 1298 m.t.Errorf("Expected call to SignatureHolderMock.WriteTo with params: %#v", *m.WriteToMock.defaultExpectation.params) 1299 } 1300 } 1301 // if func was set then invocations count should be greater than zero 1302 if m.funcWriteTo != nil && mm_atomic.LoadUint64(&m.afterWriteToCounter) < 1 { 1303 m.t.Error("Expected call to SignatureHolderMock.WriteTo") 1304 } 1305 } 1306 1307 // MinimockFinish checks that all mocked methods have been called the expected number of times 1308 func (m *SignatureHolderMock) MinimockFinish() { 1309 if !m.minimockDone() { 1310 m.MinimockAsByteStringInspect() 1311 1312 m.MinimockCopyToInspect() 1313 1314 m.MinimockEqualsInspect() 1315 1316 m.MinimockFixedByteSizeInspect() 1317 1318 m.MinimockFoldToUint64Inspect() 1319 1320 m.MinimockGetSignatureMethodInspect() 1321 1322 m.MinimockWriteToInspect() 1323 m.t.FailNow() 1324 } 1325 } 1326 1327 // MinimockWait waits for all mocked methods to be called the expected number of times 1328 func (m *SignatureHolderMock) MinimockWait(timeout mm_time.Duration) { 1329 timeoutCh := mm_time.After(timeout) 1330 for { 1331 if m.minimockDone() { 1332 return 1333 } 1334 select { 1335 case <-timeoutCh: 1336 m.MinimockFinish() 1337 return 1338 case <-mm_time.After(10 * mm_time.Millisecond): 1339 } 1340 } 1341 } 1342 1343 func (m *SignatureHolderMock) minimockDone() bool { 1344 done := true 1345 return done && 1346 m.MinimockAsByteStringDone() && 1347 m.MinimockCopyToDone() && 1348 m.MinimockEqualsDone() && 1349 m.MinimockFixedByteSizeDone() && 1350 m.MinimockFoldToUint64Done() && 1351 m.MinimockGetSignatureMethodDone() && 1352 m.MinimockWriteToDone() 1353 }