Closed Dash-L closed 5 months ago
Hey @Dash-L , thanks for the interest in my library!
Actually all the tests in this repo are run in a standard linux environment so I'm sure you'll be able to set some tests up too. To deal with that pesky max
problem I just defined a mock Arduino.h which contains a using std::max;
If you want to run the tests on your local environment just clone this repo and (on linux):
$ mkdir test/build && cd test/build
$ cmake ..
$ make
$ ./test_linear_algebra
Hope that helps!
Thanks for the quick reply!
I wasn't quite able to include a mock Arduino.h, since that gave me a lot of name conflicts using PlatformIO's build system and ArduinoFake already defines it's own Arduino.h, but I did find a way of patching the impl/NotSoBasicLinearAlgebra.h
file to include the #include <algorithm>
and using std::max;
I think this issue can be closed now, thanks again!
I've been trying to setup some unit testing/mocking for my code that will run using PlatformIO's
native
platform, but this library causes my code not to compile.Specifically, it is a reference to
max
in the global namespace, which appears to exist when compiling for arduino (or the rp2040 in my case), but not when compiling for native (see the full error below). I think it would make sense for this library to work on native since it shouldn't require anything hardware specific, and it is reasonable to want to test math heavy parts of the code.I'm not actually sure if this is a trivial fix, it feels like it would be, but I haven't yet found a way to get it to compile on native without referencing
std
somewhere (which I presume would make it not work on arduino).Thanks!
Full error: