rust-embedded/discovery

Unit testing?

gabevenberg opened this issue · 1 comments

Ive been expanding the compass a bit at https://github.com/gabevenberg/micro-bit-led-compass, adding things like tilt compensation and more directions than just the 8 using a line drawing algorithm. (in progress).

its gotten to the point where I need to unit test some of my non-hardware dependent functionality. Im not trying to do HIL testing or anything like that, I just want to logically test a few modules that are well separated from the hardware-dependent code. I tried implementing what is suggested in this post, but was not able to get tests working on the separate (no-std) crates. How should I set up unit tests for testing individual modules in embedded projects? Examples would be massively appreciated.

I did eventually figure it out and documented what I did in https://gabevenberg.com/posts/rustembeddedunittesting/. Im not entirely sure how id fit it into the book, but if there's an interest I can try to make a rough draft.