nvidia-container-toolkit/vendor/github.com/NVIDIA/go-nvml/pkg/nvml/dynamicLibrary_mock.go

158 lines
3.3 KiB
Go
Raw Permalink Normal View History

// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package nvml
import (
"sync"
)
// Ensure, that dynamicLibraryMock does implement dynamicLibrary.
// If this is not the case, regenerate this file with moq.
var _ dynamicLibrary = &dynamicLibraryMock{}
// dynamicLibraryMock is a mock implementation of dynamicLibrary.
//
// func TestSomethingThatUsesdynamicLibrary(t *testing.T) {
//
// // make and configure a mocked dynamicLibrary
// mockeddynamicLibrary := &dynamicLibraryMock{
// CloseFunc: func() error {
// panic("mock out the Close method")
// },
// LookupFunc: func(s string) error {
// panic("mock out the Lookup method")
// },
// OpenFunc: func() error {
// panic("mock out the Open method")
// },
// }
//
// // use mockeddynamicLibrary in code that requires dynamicLibrary
// // and then make assertions.
//
// }
type dynamicLibraryMock struct {
// CloseFunc mocks the Close method.
CloseFunc func() error
// LookupFunc mocks the Lookup method.
LookupFunc func(s string) error
// OpenFunc mocks the Open method.
OpenFunc func() error
// calls tracks calls to the methods.
calls struct {
// Close holds details about calls to the Close method.
Close []struct {
}
// Lookup holds details about calls to the Lookup method.
Lookup []struct {
// S is the s argument value.
S string
}
// Open holds details about calls to the Open method.
Open []struct {
}
}
lockClose sync.RWMutex
lockLookup sync.RWMutex
lockOpen sync.RWMutex
}
// Close calls CloseFunc.
func (mock *dynamicLibraryMock) Close() error {
callInfo := struct {
}{}
mock.lockClose.Lock()
mock.calls.Close = append(mock.calls.Close, callInfo)
mock.lockClose.Unlock()
if mock.CloseFunc == nil {
var (
errOut error
)
return errOut
}
return mock.CloseFunc()
}
// CloseCalls gets all the calls that were made to Close.
// Check the length with:
//
// len(mockeddynamicLibrary.CloseCalls())
func (mock *dynamicLibraryMock) CloseCalls() []struct {
} {
var calls []struct {
}
mock.lockClose.RLock()
calls = mock.calls.Close
mock.lockClose.RUnlock()
return calls
}
// Lookup calls LookupFunc.
func (mock *dynamicLibraryMock) Lookup(s string) error {
callInfo := struct {
S string
}{
S: s,
}
mock.lockLookup.Lock()
mock.calls.Lookup = append(mock.calls.Lookup, callInfo)
mock.lockLookup.Unlock()
if mock.LookupFunc == nil {
var (
errOut error
)
return errOut
}
return mock.LookupFunc(s)
}
// LookupCalls gets all the calls that were made to Lookup.
// Check the length with:
//
// len(mockeddynamicLibrary.LookupCalls())
func (mock *dynamicLibraryMock) LookupCalls() []struct {
S string
} {
var calls []struct {
S string
}
mock.lockLookup.RLock()
calls = mock.calls.Lookup
mock.lockLookup.RUnlock()
return calls
}
// Open calls OpenFunc.
func (mock *dynamicLibraryMock) Open() error {
callInfo := struct {
}{}
mock.lockOpen.Lock()
mock.calls.Open = append(mock.calls.Open, callInfo)
mock.lockOpen.Unlock()
if mock.OpenFunc == nil {
var (
errOut error
)
return errOut
}
return mock.OpenFunc()
}
// OpenCalls gets all the calls that were made to Open.
// Check the length with:
//
// len(mockeddynamicLibrary.OpenCalls())
func (mock *dynamicLibraryMock) OpenCalls() []struct {
} {
var calls []struct {
}
mock.lockOpen.RLock()
calls = mock.calls.Open
mock.lockOpen.RUnlock()
return calls
}