1

I would like to implement a unit-test for this implementation:

import "C"

// Model represents a TensorFlow Lite Model.
type Model struct {
    model *C.TfLiteModel
}

// NewModelFromFile creates a new TensorFlow Lite Model from File.
func NewModelFromFile(path string) (*Model, error) {
    m := C.TfLiteModelCreateFromFile(C.CString(path))
    if m == nil {
        return nil, ErrCreateModel
    }
    return &Model{model: m}, nil
}

I tried to use Testify to implement an idea using a mock, but I don know how to manipulate the interaction with the C binding.

Any idea that how is the best strategy to do unit-test for this type of code structure?

Nicolas Bortolotti
  • 555
  • 1
  • 8
  • 22

0 Answers0