github.com/insolar/vanilla@v0.0.0-20201023172447-248fdf805322/longbits/fixed_reader_mock.go (about)

     1  package longbits
     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  )
    13  
    14  // FixedReaderMock implements FixedReader
    15  type FixedReaderMock struct {
    16  	t minimock.Tester
    17  
    18  	funcAsByteString          func() (b1 ByteString)
    19  	inspectFuncAsByteString   func()
    20  	afterAsByteStringCounter  uint64
    21  	beforeAsByteStringCounter uint64
    22  	AsByteStringMock          mFixedReaderMockAsByteString
    23  
    24  	funcCopyTo          func(p []byte) (i1 int)
    25  	inspectFuncCopyTo   func(p []byte)
    26  	afterCopyToCounter  uint64
    27  	beforeCopyToCounter uint64
    28  	CopyToMock          mFixedReaderMockCopyTo
    29  
    30  	funcFixedByteSize          func() (i1 int)
    31  	inspectFuncFixedByteSize   func()
    32  	afterFixedByteSizeCounter  uint64
    33  	beforeFixedByteSizeCounter uint64
    34  	FixedByteSizeMock          mFixedReaderMockFixedByteSize
    35  
    36  	funcWriteTo          func(w io.Writer) (n int64, err error)
    37  	inspectFuncWriteTo   func(w io.Writer)
    38  	afterWriteToCounter  uint64
    39  	beforeWriteToCounter uint64
    40  	WriteToMock          mFixedReaderMockWriteTo
    41  }
    42  
    43  // NewFixedReaderMock returns a mock for FixedReader
    44  func NewFixedReaderMock(t minimock.Tester) *FixedReaderMock {
    45  	m := &FixedReaderMock{t: t}
    46  	if controller, ok := t.(minimock.MockController); ok {
    47  		controller.RegisterMocker(m)
    48  	}
    49  
    50  	m.AsByteStringMock = mFixedReaderMockAsByteString{mock: m}
    51  
    52  	m.CopyToMock = mFixedReaderMockCopyTo{mock: m}
    53  	m.CopyToMock.callArgs = []*FixedReaderMockCopyToParams{}
    54  
    55  	m.FixedByteSizeMock = mFixedReaderMockFixedByteSize{mock: m}
    56  
    57  	m.WriteToMock = mFixedReaderMockWriteTo{mock: m}
    58  	m.WriteToMock.callArgs = []*FixedReaderMockWriteToParams{}
    59  
    60  	return m
    61  }
    62  
    63  type mFixedReaderMockAsByteString struct {
    64  	mock               *FixedReaderMock
    65  	defaultExpectation *FixedReaderMockAsByteStringExpectation
    66  	expectations       []*FixedReaderMockAsByteStringExpectation
    67  }
    68  
    69  // FixedReaderMockAsByteStringExpectation specifies expectation struct of the FixedReader.AsByteString
    70  type FixedReaderMockAsByteStringExpectation struct {
    71  	mock *FixedReaderMock
    72  
    73  	results *FixedReaderMockAsByteStringResults
    74  	Counter uint64
    75  }
    76  
    77  // FixedReaderMockAsByteStringResults contains results of the FixedReader.AsByteString
    78  type FixedReaderMockAsByteStringResults struct {
    79  	b1 ByteString
    80  }
    81  
    82  // Expect sets up expected params for FixedReader.AsByteString
    83  func (mmAsByteString *mFixedReaderMockAsByteString) Expect() *mFixedReaderMockAsByteString {
    84  	if mmAsByteString.mock.funcAsByteString != nil {
    85  		mmAsByteString.mock.t.Fatalf("FixedReaderMock.AsByteString mock is already set by Set")
    86  	}
    87  
    88  	if mmAsByteString.defaultExpectation == nil {
    89  		mmAsByteString.defaultExpectation = &FixedReaderMockAsByteStringExpectation{}
    90  	}
    91  
    92  	return mmAsByteString
    93  }
    94  
    95  // Inspect accepts an inspector function that has same arguments as the FixedReader.AsByteString
    96  func (mmAsByteString *mFixedReaderMockAsByteString) Inspect(f func()) *mFixedReaderMockAsByteString {
    97  	if mmAsByteString.mock.inspectFuncAsByteString != nil {
    98  		mmAsByteString.mock.t.Fatalf("Inspect function is already set for FixedReaderMock.AsByteString")
    99  	}
   100  
   101  	mmAsByteString.mock.inspectFuncAsByteString = f
   102  
   103  	return mmAsByteString
   104  }
   105  
   106  // Return sets up results that will be returned by FixedReader.AsByteString
   107  func (mmAsByteString *mFixedReaderMockAsByteString) Return(b1 ByteString) *FixedReaderMock {
   108  	if mmAsByteString.mock.funcAsByteString != nil {
   109  		mmAsByteString.mock.t.Fatalf("FixedReaderMock.AsByteString mock is already set by Set")
   110  	}
   111  
   112  	if mmAsByteString.defaultExpectation == nil {
   113  		mmAsByteString.defaultExpectation = &FixedReaderMockAsByteStringExpectation{mock: mmAsByteString.mock}
   114  	}
   115  	mmAsByteString.defaultExpectation.results = &FixedReaderMockAsByteStringResults{b1}
   116  	return mmAsByteString.mock
   117  }
   118  
   119  //Set uses given function f to mock the FixedReader.AsByteString method
   120  func (mmAsByteString *mFixedReaderMockAsByteString) Set(f func() (b1 ByteString)) *FixedReaderMock {
   121  	if mmAsByteString.defaultExpectation != nil {
   122  		mmAsByteString.mock.t.Fatalf("Default expectation is already set for the FixedReader.AsByteString method")
   123  	}
   124  
   125  	if len(mmAsByteString.expectations) > 0 {
   126  		mmAsByteString.mock.t.Fatalf("Some expectations are already set for the FixedReader.AsByteString method")
   127  	}
   128  
   129  	mmAsByteString.mock.funcAsByteString = f
   130  	return mmAsByteString.mock
   131  }
   132  
   133  // AsByteString implements FixedReader
   134  func (mmAsByteString *FixedReaderMock) AsByteString() (b1 ByteString) {
   135  	mm_atomic.AddUint64(&mmAsByteString.beforeAsByteStringCounter, 1)
   136  	defer mm_atomic.AddUint64(&mmAsByteString.afterAsByteStringCounter, 1)
   137  
   138  	if mmAsByteString.inspectFuncAsByteString != nil {
   139  		mmAsByteString.inspectFuncAsByteString()
   140  	}
   141  
   142  	if mmAsByteString.AsByteStringMock.defaultExpectation != nil {
   143  		mm_atomic.AddUint64(&mmAsByteString.AsByteStringMock.defaultExpectation.Counter, 1)
   144  
   145  		mm_results := mmAsByteString.AsByteStringMock.defaultExpectation.results
   146  		if mm_results == nil {
   147  			mmAsByteString.t.Fatal("No results are set for the FixedReaderMock.AsByteString")
   148  		}
   149  		return (*mm_results).b1
   150  	}
   151  	if mmAsByteString.funcAsByteString != nil {
   152  		return mmAsByteString.funcAsByteString()
   153  	}
   154  	mmAsByteString.t.Fatalf("Unexpected call to FixedReaderMock.AsByteString.")
   155  	return
   156  }
   157  
   158  // AsByteStringAfterCounter returns a count of finished FixedReaderMock.AsByteString invocations
   159  func (mmAsByteString *FixedReaderMock) AsByteStringAfterCounter() uint64 {
   160  	return mm_atomic.LoadUint64(&mmAsByteString.afterAsByteStringCounter)
   161  }
   162  
   163  // AsByteStringBeforeCounter returns a count of FixedReaderMock.AsByteString invocations
   164  func (mmAsByteString *FixedReaderMock) AsByteStringBeforeCounter() uint64 {
   165  	return mm_atomic.LoadUint64(&mmAsByteString.beforeAsByteStringCounter)
   166  }
   167  
   168  // MinimockAsByteStringDone returns true if the count of the AsByteString invocations corresponds
   169  // the number of defined expectations
   170  func (m *FixedReaderMock) MinimockAsByteStringDone() bool {
   171  	for _, e := range m.AsByteStringMock.expectations {
   172  		if mm_atomic.LoadUint64(&e.Counter) < 1 {
   173  			return false
   174  		}
   175  	}
   176  
   177  	// if default expectation was set then invocations count should be greater than zero
   178  	if m.AsByteStringMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAsByteStringCounter) < 1 {
   179  		return false
   180  	}
   181  	// if func was set then invocations count should be greater than zero
   182  	if m.funcAsByteString != nil && mm_atomic.LoadUint64(&m.afterAsByteStringCounter) < 1 {
   183  		return false
   184  	}
   185  	return true
   186  }
   187  
   188  // MinimockAsByteStringInspect logs each unmet expectation
   189  func (m *FixedReaderMock) MinimockAsByteStringInspect() {
   190  	for _, e := range m.AsByteStringMock.expectations {
   191  		if mm_atomic.LoadUint64(&e.Counter) < 1 {
   192  			m.t.Error("Expected call to FixedReaderMock.AsByteString")
   193  		}
   194  	}
   195  
   196  	// if default expectation was set then invocations count should be greater than zero
   197  	if m.AsByteStringMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAsByteStringCounter) < 1 {
   198  		m.t.Error("Expected call to FixedReaderMock.AsByteString")
   199  	}
   200  	// if func was set then invocations count should be greater than zero
   201  	if m.funcAsByteString != nil && mm_atomic.LoadUint64(&m.afterAsByteStringCounter) < 1 {
   202  		m.t.Error("Expected call to FixedReaderMock.AsByteString")
   203  	}
   204  }
   205  
   206  type mFixedReaderMockCopyTo struct {
   207  	mock               *FixedReaderMock
   208  	defaultExpectation *FixedReaderMockCopyToExpectation
   209  	expectations       []*FixedReaderMockCopyToExpectation
   210  
   211  	callArgs []*FixedReaderMockCopyToParams
   212  	mutex    sync.RWMutex
   213  }
   214  
   215  // FixedReaderMockCopyToExpectation specifies expectation struct of the FixedReader.CopyTo
   216  type FixedReaderMockCopyToExpectation struct {
   217  	mock    *FixedReaderMock
   218  	params  *FixedReaderMockCopyToParams
   219  	results *FixedReaderMockCopyToResults
   220  	Counter uint64
   221  }
   222  
   223  // FixedReaderMockCopyToParams contains parameters of the FixedReader.CopyTo
   224  type FixedReaderMockCopyToParams struct {
   225  	p []byte
   226  }
   227  
   228  // FixedReaderMockCopyToResults contains results of the FixedReader.CopyTo
   229  type FixedReaderMockCopyToResults struct {
   230  	i1 int
   231  }
   232  
   233  // Expect sets up expected params for FixedReader.CopyTo
   234  func (mmCopyTo *mFixedReaderMockCopyTo) Expect(p []byte) *mFixedReaderMockCopyTo {
   235  	if mmCopyTo.mock.funcCopyTo != nil {
   236  		mmCopyTo.mock.t.Fatalf("FixedReaderMock.CopyTo mock is already set by Set")
   237  	}
   238  
   239  	if mmCopyTo.defaultExpectation == nil {
   240  		mmCopyTo.defaultExpectation = &FixedReaderMockCopyToExpectation{}
   241  	}
   242  
   243  	mmCopyTo.defaultExpectation.params = &FixedReaderMockCopyToParams{p}
   244  	for _, e := range mmCopyTo.expectations {
   245  		if minimock.Equal(e.params, mmCopyTo.defaultExpectation.params) {
   246  			mmCopyTo.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCopyTo.defaultExpectation.params)
   247  		}
   248  	}
   249  
   250  	return mmCopyTo
   251  }
   252  
   253  // Inspect accepts an inspector function that has same arguments as the FixedReader.CopyTo
   254  func (mmCopyTo *mFixedReaderMockCopyTo) Inspect(f func(p []byte)) *mFixedReaderMockCopyTo {
   255  	if mmCopyTo.mock.inspectFuncCopyTo != nil {
   256  		mmCopyTo.mock.t.Fatalf("Inspect function is already set for FixedReaderMock.CopyTo")
   257  	}
   258  
   259  	mmCopyTo.mock.inspectFuncCopyTo = f
   260  
   261  	return mmCopyTo
   262  }
   263  
   264  // Return sets up results that will be returned by FixedReader.CopyTo
   265  func (mmCopyTo *mFixedReaderMockCopyTo) Return(i1 int) *FixedReaderMock {
   266  	if mmCopyTo.mock.funcCopyTo != nil {
   267  		mmCopyTo.mock.t.Fatalf("FixedReaderMock.CopyTo mock is already set by Set")
   268  	}
   269  
   270  	if mmCopyTo.defaultExpectation == nil {
   271  		mmCopyTo.defaultExpectation = &FixedReaderMockCopyToExpectation{mock: mmCopyTo.mock}
   272  	}
   273  	mmCopyTo.defaultExpectation.results = &FixedReaderMockCopyToResults{i1}
   274  	return mmCopyTo.mock
   275  }
   276  
   277  //Set uses given function f to mock the FixedReader.CopyTo method
   278  func (mmCopyTo *mFixedReaderMockCopyTo) Set(f func(p []byte) (i1 int)) *FixedReaderMock {
   279  	if mmCopyTo.defaultExpectation != nil {
   280  		mmCopyTo.mock.t.Fatalf("Default expectation is already set for the FixedReader.CopyTo method")
   281  	}
   282  
   283  	if len(mmCopyTo.expectations) > 0 {
   284  		mmCopyTo.mock.t.Fatalf("Some expectations are already set for the FixedReader.CopyTo method")
   285  	}
   286  
   287  	mmCopyTo.mock.funcCopyTo = f
   288  	return mmCopyTo.mock
   289  }
   290  
   291  // When sets expectation for the FixedReader.CopyTo which will trigger the result defined by the following
   292  // Then helper
   293  func (mmCopyTo *mFixedReaderMockCopyTo) When(p []byte) *FixedReaderMockCopyToExpectation {
   294  	if mmCopyTo.mock.funcCopyTo != nil {
   295  		mmCopyTo.mock.t.Fatalf("FixedReaderMock.CopyTo mock is already set by Set")
   296  	}
   297  
   298  	expectation := &FixedReaderMockCopyToExpectation{
   299  		mock:   mmCopyTo.mock,
   300  		params: &FixedReaderMockCopyToParams{p},
   301  	}
   302  	mmCopyTo.expectations = append(mmCopyTo.expectations, expectation)
   303  	return expectation
   304  }
   305  
   306  // Then sets up FixedReader.CopyTo return parameters for the expectation previously defined by the When method
   307  func (e *FixedReaderMockCopyToExpectation) Then(i1 int) *FixedReaderMock {
   308  	e.results = &FixedReaderMockCopyToResults{i1}
   309  	return e.mock
   310  }
   311  
   312  // CopyTo implements FixedReader
   313  func (mmCopyTo *FixedReaderMock) CopyTo(p []byte) (i1 int) {
   314  	mm_atomic.AddUint64(&mmCopyTo.beforeCopyToCounter, 1)
   315  	defer mm_atomic.AddUint64(&mmCopyTo.afterCopyToCounter, 1)
   316  
   317  	if mmCopyTo.inspectFuncCopyTo != nil {
   318  		mmCopyTo.inspectFuncCopyTo(p)
   319  	}
   320  
   321  	mm_params := &FixedReaderMockCopyToParams{p}
   322  
   323  	// Record call args
   324  	mmCopyTo.CopyToMock.mutex.Lock()
   325  	mmCopyTo.CopyToMock.callArgs = append(mmCopyTo.CopyToMock.callArgs, mm_params)
   326  	mmCopyTo.CopyToMock.mutex.Unlock()
   327  
   328  	for _, e := range mmCopyTo.CopyToMock.expectations {
   329  		if minimock.Equal(e.params, mm_params) {
   330  			mm_atomic.AddUint64(&e.Counter, 1)
   331  			return e.results.i1
   332  		}
   333  	}
   334  
   335  	if mmCopyTo.CopyToMock.defaultExpectation != nil {
   336  		mm_atomic.AddUint64(&mmCopyTo.CopyToMock.defaultExpectation.Counter, 1)
   337  		mm_want := mmCopyTo.CopyToMock.defaultExpectation.params
   338  		mm_got := FixedReaderMockCopyToParams{p}
   339  		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
   340  			mmCopyTo.t.Errorf("FixedReaderMock.CopyTo got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
   341  		}
   342  
   343  		mm_results := mmCopyTo.CopyToMock.defaultExpectation.results
   344  		if mm_results == nil {
   345  			mmCopyTo.t.Fatal("No results are set for the FixedReaderMock.CopyTo")
   346  		}
   347  		return (*mm_results).i1
   348  	}
   349  	if mmCopyTo.funcCopyTo != nil {
   350  		return mmCopyTo.funcCopyTo(p)
   351  	}
   352  	mmCopyTo.t.Fatalf("Unexpected call to FixedReaderMock.CopyTo. %v", p)
   353  	return
   354  }
   355  
   356  // CopyToAfterCounter returns a count of finished FixedReaderMock.CopyTo invocations
   357  func (mmCopyTo *FixedReaderMock) CopyToAfterCounter() uint64 {
   358  	return mm_atomic.LoadUint64(&mmCopyTo.afterCopyToCounter)
   359  }
   360  
   361  // CopyToBeforeCounter returns a count of FixedReaderMock.CopyTo invocations
   362  func (mmCopyTo *FixedReaderMock) CopyToBeforeCounter() uint64 {
   363  	return mm_atomic.LoadUint64(&mmCopyTo.beforeCopyToCounter)
   364  }
   365  
   366  // Calls returns a list of arguments used in each call to FixedReaderMock.CopyTo.
   367  // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
   368  func (mmCopyTo *mFixedReaderMockCopyTo) Calls() []*FixedReaderMockCopyToParams {
   369  	mmCopyTo.mutex.RLock()
   370  
   371  	argCopy := make([]*FixedReaderMockCopyToParams, len(mmCopyTo.callArgs))
   372  	copy(argCopy, mmCopyTo.callArgs)
   373  
   374  	mmCopyTo.mutex.RUnlock()
   375  
   376  	return argCopy
   377  }
   378  
   379  // MinimockCopyToDone returns true if the count of the CopyTo invocations corresponds
   380  // the number of defined expectations
   381  func (m *FixedReaderMock) MinimockCopyToDone() bool {
   382  	for _, e := range m.CopyToMock.expectations {
   383  		if mm_atomic.LoadUint64(&e.Counter) < 1 {
   384  			return false
   385  		}
   386  	}
   387  
   388  	// if default expectation was set then invocations count should be greater than zero
   389  	if m.CopyToMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCopyToCounter) < 1 {
   390  		return false
   391  	}
   392  	// if func was set then invocations count should be greater than zero
   393  	if m.funcCopyTo != nil && mm_atomic.LoadUint64(&m.afterCopyToCounter) < 1 {
   394  		return false
   395  	}
   396  	return true
   397  }
   398  
   399  // MinimockCopyToInspect logs each unmet expectation
   400  func (m *FixedReaderMock) MinimockCopyToInspect() {
   401  	for _, e := range m.CopyToMock.expectations {
   402  		if mm_atomic.LoadUint64(&e.Counter) < 1 {
   403  			m.t.Errorf("Expected call to FixedReaderMock.CopyTo with params: %#v", *e.params)
   404  		}
   405  	}
   406  
   407  	// if default expectation was set then invocations count should be greater than zero
   408  	if m.CopyToMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCopyToCounter) < 1 {
   409  		if m.CopyToMock.defaultExpectation.params == nil {
   410  			m.t.Error("Expected call to FixedReaderMock.CopyTo")
   411  		} else {
   412  			m.t.Errorf("Expected call to FixedReaderMock.CopyTo with params: %#v", *m.CopyToMock.defaultExpectation.params)
   413  		}
   414  	}
   415  	// if func was set then invocations count should be greater than zero
   416  	if m.funcCopyTo != nil && mm_atomic.LoadUint64(&m.afterCopyToCounter) < 1 {
   417  		m.t.Error("Expected call to FixedReaderMock.CopyTo")
   418  	}
   419  }
   420  
   421  type mFixedReaderMockFixedByteSize struct {
   422  	mock               *FixedReaderMock
   423  	defaultExpectation *FixedReaderMockFixedByteSizeExpectation
   424  	expectations       []*FixedReaderMockFixedByteSizeExpectation
   425  }
   426  
   427  // FixedReaderMockFixedByteSizeExpectation specifies expectation struct of the FixedReader.FixedByteSize
   428  type FixedReaderMockFixedByteSizeExpectation struct {
   429  	mock *FixedReaderMock
   430  
   431  	results *FixedReaderMockFixedByteSizeResults
   432  	Counter uint64
   433  }
   434  
   435  // FixedReaderMockFixedByteSizeResults contains results of the FixedReader.FixedByteSize
   436  type FixedReaderMockFixedByteSizeResults struct {
   437  	i1 int
   438  }
   439  
   440  // Expect sets up expected params for FixedReader.FixedByteSize
   441  func (mmFixedByteSize *mFixedReaderMockFixedByteSize) Expect() *mFixedReaderMockFixedByteSize {
   442  	if mmFixedByteSize.mock.funcFixedByteSize != nil {
   443  		mmFixedByteSize.mock.t.Fatalf("FixedReaderMock.FixedByteSize mock is already set by Set")
   444  	}
   445  
   446  	if mmFixedByteSize.defaultExpectation == nil {
   447  		mmFixedByteSize.defaultExpectation = &FixedReaderMockFixedByteSizeExpectation{}
   448  	}
   449  
   450  	return mmFixedByteSize
   451  }
   452  
   453  // Inspect accepts an inspector function that has same arguments as the FixedReader.FixedByteSize
   454  func (mmFixedByteSize *mFixedReaderMockFixedByteSize) Inspect(f func()) *mFixedReaderMockFixedByteSize {
   455  	if mmFixedByteSize.mock.inspectFuncFixedByteSize != nil {
   456  		mmFixedByteSize.mock.t.Fatalf("Inspect function is already set for FixedReaderMock.FixedByteSize")
   457  	}
   458  
   459  	mmFixedByteSize.mock.inspectFuncFixedByteSize = f
   460  
   461  	return mmFixedByteSize
   462  }
   463  
   464  // Return sets up results that will be returned by FixedReader.FixedByteSize
   465  func (mmFixedByteSize *mFixedReaderMockFixedByteSize) Return(i1 int) *FixedReaderMock {
   466  	if mmFixedByteSize.mock.funcFixedByteSize != nil {
   467  		mmFixedByteSize.mock.t.Fatalf("FixedReaderMock.FixedByteSize mock is already set by Set")
   468  	}
   469  
   470  	if mmFixedByteSize.defaultExpectation == nil {
   471  		mmFixedByteSize.defaultExpectation = &FixedReaderMockFixedByteSizeExpectation{mock: mmFixedByteSize.mock}
   472  	}
   473  	mmFixedByteSize.defaultExpectation.results = &FixedReaderMockFixedByteSizeResults{i1}
   474  	return mmFixedByteSize.mock
   475  }
   476  
   477  //Set uses given function f to mock the FixedReader.FixedByteSize method
   478  func (mmFixedByteSize *mFixedReaderMockFixedByteSize) Set(f func() (i1 int)) *FixedReaderMock {
   479  	if mmFixedByteSize.defaultExpectation != nil {
   480  		mmFixedByteSize.mock.t.Fatalf("Default expectation is already set for the FixedReader.FixedByteSize method")
   481  	}
   482  
   483  	if len(mmFixedByteSize.expectations) > 0 {
   484  		mmFixedByteSize.mock.t.Fatalf("Some expectations are already set for the FixedReader.FixedByteSize method")
   485  	}
   486  
   487  	mmFixedByteSize.mock.funcFixedByteSize = f
   488  	return mmFixedByteSize.mock
   489  }
   490  
   491  // FixedByteSize implements FixedReader
   492  func (mmFixedByteSize *FixedReaderMock) FixedByteSize() (i1 int) {
   493  	mm_atomic.AddUint64(&mmFixedByteSize.beforeFixedByteSizeCounter, 1)
   494  	defer mm_atomic.AddUint64(&mmFixedByteSize.afterFixedByteSizeCounter, 1)
   495  
   496  	if mmFixedByteSize.inspectFuncFixedByteSize != nil {
   497  		mmFixedByteSize.inspectFuncFixedByteSize()
   498  	}
   499  
   500  	if mmFixedByteSize.FixedByteSizeMock.defaultExpectation != nil {
   501  		mm_atomic.AddUint64(&mmFixedByteSize.FixedByteSizeMock.defaultExpectation.Counter, 1)
   502  
   503  		mm_results := mmFixedByteSize.FixedByteSizeMock.defaultExpectation.results
   504  		if mm_results == nil {
   505  			mmFixedByteSize.t.Fatal("No results are set for the FixedReaderMock.FixedByteSize")
   506  		}
   507  		return (*mm_results).i1
   508  	}
   509  	if mmFixedByteSize.funcFixedByteSize != nil {
   510  		return mmFixedByteSize.funcFixedByteSize()
   511  	}
   512  	mmFixedByteSize.t.Fatalf("Unexpected call to FixedReaderMock.FixedByteSize.")
   513  	return
   514  }
   515  
   516  // FixedByteSizeAfterCounter returns a count of finished FixedReaderMock.FixedByteSize invocations
   517  func (mmFixedByteSize *FixedReaderMock) FixedByteSizeAfterCounter() uint64 {
   518  	return mm_atomic.LoadUint64(&mmFixedByteSize.afterFixedByteSizeCounter)
   519  }
   520  
   521  // FixedByteSizeBeforeCounter returns a count of FixedReaderMock.FixedByteSize invocations
   522  func (mmFixedByteSize *FixedReaderMock) FixedByteSizeBeforeCounter() uint64 {
   523  	return mm_atomic.LoadUint64(&mmFixedByteSize.beforeFixedByteSizeCounter)
   524  }
   525  
   526  // MinimockFixedByteSizeDone returns true if the count of the FixedByteSize invocations corresponds
   527  // the number of defined expectations
   528  func (m *FixedReaderMock) MinimockFixedByteSizeDone() bool {
   529  	for _, e := range m.FixedByteSizeMock.expectations {
   530  		if mm_atomic.LoadUint64(&e.Counter) < 1 {
   531  			return false
   532  		}
   533  	}
   534  
   535  	// if default expectation was set then invocations count should be greater than zero
   536  	if m.FixedByteSizeMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterFixedByteSizeCounter) < 1 {
   537  		return false
   538  	}
   539  	// if func was set then invocations count should be greater than zero
   540  	if m.funcFixedByteSize != nil && mm_atomic.LoadUint64(&m.afterFixedByteSizeCounter) < 1 {
   541  		return false
   542  	}
   543  	return true
   544  }
   545  
   546  // MinimockFixedByteSizeInspect logs each unmet expectation
   547  func (m *FixedReaderMock) MinimockFixedByteSizeInspect() {
   548  	for _, e := range m.FixedByteSizeMock.expectations {
   549  		if mm_atomic.LoadUint64(&e.Counter) < 1 {
   550  			m.t.Error("Expected call to FixedReaderMock.FixedByteSize")
   551  		}
   552  	}
   553  
   554  	// if default expectation was set then invocations count should be greater than zero
   555  	if m.FixedByteSizeMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterFixedByteSizeCounter) < 1 {
   556  		m.t.Error("Expected call to FixedReaderMock.FixedByteSize")
   557  	}
   558  	// if func was set then invocations count should be greater than zero
   559  	if m.funcFixedByteSize != nil && mm_atomic.LoadUint64(&m.afterFixedByteSizeCounter) < 1 {
   560  		m.t.Error("Expected call to FixedReaderMock.FixedByteSize")
   561  	}
   562  }
   563  
   564  type mFixedReaderMockWriteTo struct {
   565  	mock               *FixedReaderMock
   566  	defaultExpectation *FixedReaderMockWriteToExpectation
   567  	expectations       []*FixedReaderMockWriteToExpectation
   568  
   569  	callArgs []*FixedReaderMockWriteToParams
   570  	mutex    sync.RWMutex
   571  }
   572  
   573  // FixedReaderMockWriteToExpectation specifies expectation struct of the FixedReader.WriteTo
   574  type FixedReaderMockWriteToExpectation struct {
   575  	mock    *FixedReaderMock
   576  	params  *FixedReaderMockWriteToParams
   577  	results *FixedReaderMockWriteToResults
   578  	Counter uint64
   579  }
   580  
   581  // FixedReaderMockWriteToParams contains parameters of the FixedReader.WriteTo
   582  type FixedReaderMockWriteToParams struct {
   583  	w io.Writer
   584  }
   585  
   586  // FixedReaderMockWriteToResults contains results of the FixedReader.WriteTo
   587  type FixedReaderMockWriteToResults struct {
   588  	n   int64
   589  	err error
   590  }
   591  
   592  // Expect sets up expected params for FixedReader.WriteTo
   593  func (mmWriteTo *mFixedReaderMockWriteTo) Expect(w io.Writer) *mFixedReaderMockWriteTo {
   594  	if mmWriteTo.mock.funcWriteTo != nil {
   595  		mmWriteTo.mock.t.Fatalf("FixedReaderMock.WriteTo mock is already set by Set")
   596  	}
   597  
   598  	if mmWriteTo.defaultExpectation == nil {
   599  		mmWriteTo.defaultExpectation = &FixedReaderMockWriteToExpectation{}
   600  	}
   601  
   602  	mmWriteTo.defaultExpectation.params = &FixedReaderMockWriteToParams{w}
   603  	for _, e := range mmWriteTo.expectations {
   604  		if minimock.Equal(e.params, mmWriteTo.defaultExpectation.params) {
   605  			mmWriteTo.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmWriteTo.defaultExpectation.params)
   606  		}
   607  	}
   608  
   609  	return mmWriteTo
   610  }
   611  
   612  // Inspect accepts an inspector function that has same arguments as the FixedReader.WriteTo
   613  func (mmWriteTo *mFixedReaderMockWriteTo) Inspect(f func(w io.Writer)) *mFixedReaderMockWriteTo {
   614  	if mmWriteTo.mock.inspectFuncWriteTo != nil {
   615  		mmWriteTo.mock.t.Fatalf("Inspect function is already set for FixedReaderMock.WriteTo")
   616  	}
   617  
   618  	mmWriteTo.mock.inspectFuncWriteTo = f
   619  
   620  	return mmWriteTo
   621  }
   622  
   623  // Return sets up results that will be returned by FixedReader.WriteTo
   624  func (mmWriteTo *mFixedReaderMockWriteTo) Return(n int64, err error) *FixedReaderMock {
   625  	if mmWriteTo.mock.funcWriteTo != nil {
   626  		mmWriteTo.mock.t.Fatalf("FixedReaderMock.WriteTo mock is already set by Set")
   627  	}
   628  
   629  	if mmWriteTo.defaultExpectation == nil {
   630  		mmWriteTo.defaultExpectation = &FixedReaderMockWriteToExpectation{mock: mmWriteTo.mock}
   631  	}
   632  	mmWriteTo.defaultExpectation.results = &FixedReaderMockWriteToResults{n, err}
   633  	return mmWriteTo.mock
   634  }
   635  
   636  //Set uses given function f to mock the FixedReader.WriteTo method
   637  func (mmWriteTo *mFixedReaderMockWriteTo) Set(f func(w io.Writer) (n int64, err error)) *FixedReaderMock {
   638  	if mmWriteTo.defaultExpectation != nil {
   639  		mmWriteTo.mock.t.Fatalf("Default expectation is already set for the FixedReader.WriteTo method")
   640  	}
   641  
   642  	if len(mmWriteTo.expectations) > 0 {
   643  		mmWriteTo.mock.t.Fatalf("Some expectations are already set for the FixedReader.WriteTo method")
   644  	}
   645  
   646  	mmWriteTo.mock.funcWriteTo = f
   647  	return mmWriteTo.mock
   648  }
   649  
   650  // When sets expectation for the FixedReader.WriteTo which will trigger the result defined by the following
   651  // Then helper
   652  func (mmWriteTo *mFixedReaderMockWriteTo) When(w io.Writer) *FixedReaderMockWriteToExpectation {
   653  	if mmWriteTo.mock.funcWriteTo != nil {
   654  		mmWriteTo.mock.t.Fatalf("FixedReaderMock.WriteTo mock is already set by Set")
   655  	}
   656  
   657  	expectation := &FixedReaderMockWriteToExpectation{
   658  		mock:   mmWriteTo.mock,
   659  		params: &FixedReaderMockWriteToParams{w},
   660  	}
   661  	mmWriteTo.expectations = append(mmWriteTo.expectations, expectation)
   662  	return expectation
   663  }
   664  
   665  // Then sets up FixedReader.WriteTo return parameters for the expectation previously defined by the When method
   666  func (e *FixedReaderMockWriteToExpectation) Then(n int64, err error) *FixedReaderMock {
   667  	e.results = &FixedReaderMockWriteToResults{n, err}
   668  	return e.mock
   669  }
   670  
   671  // WriteTo implements FixedReader
   672  func (mmWriteTo *FixedReaderMock) WriteTo(w io.Writer) (n int64, err error) {
   673  	mm_atomic.AddUint64(&mmWriteTo.beforeWriteToCounter, 1)
   674  	defer mm_atomic.AddUint64(&mmWriteTo.afterWriteToCounter, 1)
   675  
   676  	if mmWriteTo.inspectFuncWriteTo != nil {
   677  		mmWriteTo.inspectFuncWriteTo(w)
   678  	}
   679  
   680  	mm_params := &FixedReaderMockWriteToParams{w}
   681  
   682  	// Record call args
   683  	mmWriteTo.WriteToMock.mutex.Lock()
   684  	mmWriteTo.WriteToMock.callArgs = append(mmWriteTo.WriteToMock.callArgs, mm_params)
   685  	mmWriteTo.WriteToMock.mutex.Unlock()
   686  
   687  	for _, e := range mmWriteTo.WriteToMock.expectations {
   688  		if minimock.Equal(e.params, mm_params) {
   689  			mm_atomic.AddUint64(&e.Counter, 1)
   690  			return e.results.n, e.results.err
   691  		}
   692  	}
   693  
   694  	if mmWriteTo.WriteToMock.defaultExpectation != nil {
   695  		mm_atomic.AddUint64(&mmWriteTo.WriteToMock.defaultExpectation.Counter, 1)
   696  		mm_want := mmWriteTo.WriteToMock.defaultExpectation.params
   697  		mm_got := FixedReaderMockWriteToParams{w}
   698  		if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
   699  			mmWriteTo.t.Errorf("FixedReaderMock.WriteTo got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
   700  		}
   701  
   702  		mm_results := mmWriteTo.WriteToMock.defaultExpectation.results
   703  		if mm_results == nil {
   704  			mmWriteTo.t.Fatal("No results are set for the FixedReaderMock.WriteTo")
   705  		}
   706  		return (*mm_results).n, (*mm_results).err
   707  	}
   708  	if mmWriteTo.funcWriteTo != nil {
   709  		return mmWriteTo.funcWriteTo(w)
   710  	}
   711  	mmWriteTo.t.Fatalf("Unexpected call to FixedReaderMock.WriteTo. %v", w)
   712  	return
   713  }
   714  
   715  // WriteToAfterCounter returns a count of finished FixedReaderMock.WriteTo invocations
   716  func (mmWriteTo *FixedReaderMock) WriteToAfterCounter() uint64 {
   717  	return mm_atomic.LoadUint64(&mmWriteTo.afterWriteToCounter)
   718  }
   719  
   720  // WriteToBeforeCounter returns a count of FixedReaderMock.WriteTo invocations
   721  func (mmWriteTo *FixedReaderMock) WriteToBeforeCounter() uint64 {
   722  	return mm_atomic.LoadUint64(&mmWriteTo.beforeWriteToCounter)
   723  }
   724  
   725  // Calls returns a list of arguments used in each call to FixedReaderMock.WriteTo.
   726  // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
   727  func (mmWriteTo *mFixedReaderMockWriteTo) Calls() []*FixedReaderMockWriteToParams {
   728  	mmWriteTo.mutex.RLock()
   729  
   730  	argCopy := make([]*FixedReaderMockWriteToParams, len(mmWriteTo.callArgs))
   731  	copy(argCopy, mmWriteTo.callArgs)
   732  
   733  	mmWriteTo.mutex.RUnlock()
   734  
   735  	return argCopy
   736  }
   737  
   738  // MinimockWriteToDone returns true if the count of the WriteTo invocations corresponds
   739  // the number of defined expectations
   740  func (m *FixedReaderMock) MinimockWriteToDone() bool {
   741  	for _, e := range m.WriteToMock.expectations {
   742  		if mm_atomic.LoadUint64(&e.Counter) < 1 {
   743  			return false
   744  		}
   745  	}
   746  
   747  	// if default expectation was set then invocations count should be greater than zero
   748  	if m.WriteToMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterWriteToCounter) < 1 {
   749  		return false
   750  	}
   751  	// if func was set then invocations count should be greater than zero
   752  	if m.funcWriteTo != nil && mm_atomic.LoadUint64(&m.afterWriteToCounter) < 1 {
   753  		return false
   754  	}
   755  	return true
   756  }
   757  
   758  // MinimockWriteToInspect logs each unmet expectation
   759  func (m *FixedReaderMock) MinimockWriteToInspect() {
   760  	for _, e := range m.WriteToMock.expectations {
   761  		if mm_atomic.LoadUint64(&e.Counter) < 1 {
   762  			m.t.Errorf("Expected call to FixedReaderMock.WriteTo with params: %#v", *e.params)
   763  		}
   764  	}
   765  
   766  	// if default expectation was set then invocations count should be greater than zero
   767  	if m.WriteToMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterWriteToCounter) < 1 {
   768  		if m.WriteToMock.defaultExpectation.params == nil {
   769  			m.t.Error("Expected call to FixedReaderMock.WriteTo")
   770  		} else {
   771  			m.t.Errorf("Expected call to FixedReaderMock.WriteTo with params: %#v", *m.WriteToMock.defaultExpectation.params)
   772  		}
   773  	}
   774  	// if func was set then invocations count should be greater than zero
   775  	if m.funcWriteTo != nil && mm_atomic.LoadUint64(&m.afterWriteToCounter) < 1 {
   776  		m.t.Error("Expected call to FixedReaderMock.WriteTo")
   777  	}
   778  }
   779  
   780  // MinimockFinish checks that all mocked methods have been called the expected number of times
   781  func (m *FixedReaderMock) MinimockFinish() {
   782  	if !m.minimockDone() {
   783  		m.MinimockAsByteStringInspect()
   784  
   785  		m.MinimockCopyToInspect()
   786  
   787  		m.MinimockFixedByteSizeInspect()
   788  
   789  		m.MinimockWriteToInspect()
   790  		m.t.FailNow()
   791  	}
   792  }
   793  
   794  // MinimockWait waits for all mocked methods to be called the expected number of times
   795  func (m *FixedReaderMock) MinimockWait(timeout mm_time.Duration) {
   796  	timeoutCh := mm_time.After(timeout)
   797  	for {
   798  		if m.minimockDone() {
   799  			return
   800  		}
   801  		select {
   802  		case <-timeoutCh:
   803  			m.MinimockFinish()
   804  			return
   805  		case <-mm_time.After(10 * mm_time.Millisecond):
   806  		}
   807  	}
   808  }
   809  
   810  func (m *FixedReaderMock) minimockDone() bool {
   811  	done := true
   812  	return done &&
   813  		m.MinimockAsByteStringDone() &&
   814  		m.MinimockCopyToDone() &&
   815  		m.MinimockFixedByteSizeDone() &&
   816  		m.MinimockWriteToDone()
   817  }