drivers icon indicating copy to clipboard operation
drivers copied to clipboard

Expectation driven SPI test helper (RFC)

Open jmhobbs opened this issue 10 months ago • 4 comments

This is my WAG at an SPI test helper after I wrote #738

It's based on ordered Tx expecations. I also had to make a partial Pin interface as input to my MAX6675, I'm not sure how to finish that out in a meaningful way without machine. I'm not sure if the chip select pin should be part of the test helper or an independent concern.

I'll leave this here as a discussion point, but happy to adjust or expand this as well as try my hand and testing some of the other SPI based drivers to get a feel for the API here.

jmhobbs avatar Feb 18 '25 20:02 jmhobbs

Very cool, I will take a look!

deadprogram avatar Feb 19 '25 08:02 deadprogram

I also had to make a partial Pin interface

We were needing to do something about that probably, however since some drivers do very specific things with Pin we will have to see how far we can take that.

I'm not sure if the chip select pin should be part of the test helper or an independent concern.

A very good question. Since we do that CS "manually" in the drivers, it probably needs to be somehow separated.

deadprogram avatar Feb 22 '25 14:02 deadprogram

I added another, very basic expectation based Pin implementation as well. Works for CS at least.

jmhobbs avatar Mar 13 '25 03:03 jmhobbs

Using something like testify/mock and mockery might be a better direction for these.

jmhobbs avatar Mar 13 '25 03:03 jmhobbs