Closed bxparks closed 6 years ago
One bit of context that I left out in my original post which might help you digest all this. I was trying to create 2 example tests:
I was successful in case 1. I'm pretty sure that I succeeded in case 2, because the if-statement does what I want, but that's when I found that assertLess()
doesn't do what the if-statement does.
Case 2 is where mock unit tests running on some other (32-bit) environments will have trouble detecting problems with code that will fail on AVR.
The 2.3 branch does type widening to limit the number of specializations of the comparison that are made. char and short promote to int, unsigned char and unsigned short promote to unsigned, float promotes to double. After promotion, both sizes are the same, so the C++ rule is to compare as unsigned. I did this because it saves a lot of specializations (and therefore space) and did not realize it changed comparison semantics (the compiler warns you if you have those options enabled as you pointed out) between signed and unsigned types. I think most of the space saving comes from unifying strings, so maybe just putting back the integer type specializations would get back to a<b equivalency (on the same hardware). Getting a<b equivalency across platforms sounds like a pipe dream, and the argument for allowing unit tests in the embedded environment in any case. I created a branch iss77 which removes the extra widening. Hard call. The compiler does generate warnings. The extra space.
Ok I changed the widening to a nice compromise that takes both argument types into account. It doesn't try to do anything with mixed signed / unsigned types, which hopefully are rare, but does promote along normal char,short,int,long,long long in a manner that preserves a<b meaning. And save space.
So the latest version on master does not compile on Teensy or ESP8266. The error messages are about the same on the 2 platforms, modulo file paths. I think I mentioned previously that you don't need to own these microcontrollers to verify, you can verify the compile without uploading.
Build options changed, rebuilding all
In file included from /home/brian/Downloads/Arduino/arduino-1.8.5/hardware/teensy/avr/cores/teensy3/WString.h:28:0,
from /home/brian/Downloads/Arduino/arduino-1.8.5/hardware/teensy/avr/cores/teensy3/Print.h:38,
from /home/brian/Downloads/Arduino/arduino-1.8.5/hardware/teensy/avr/cores/teensy3/Stream.h:24,
from /home/brian/Downloads/Arduino/arduino-1.8.5/hardware/teensy/avr/cores/teensy3/HardwareSerial.h:252,
from /home/brian/Downloads/Arduino/arduino-1.8.5/hardware/teensy/avr/cores/teensy3/WProgram.h:46,
from /home/brian/Downloads/Arduino/arduino-1.8.5/hardware/teensy/avr/cores/teensy3/Arduino.h:3,
from /tmp/arduino_build_983557/sketch/ArduinoUnitCompareProblem.ino.cpp:1:
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:30:33: error: expected nested-name-specifier before numeric constant
template <typename _A, typename _B> struct ArduinoUnitDoubleWide {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:30:33: error: expected '>' before numeric constant
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:32:11: error: expected unqualified-id before numeric constant
typedef _B B;
^
In file included from /home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/Compare.h:3:0,
from /home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:12,
from sketch.ino:2:
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:37:57: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < char , char > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:37:57: note: expected a constant of type 'int', got 'char'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:42:58: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < char , short > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:42:58: note: expected a constant of type 'int', got 'short int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:47:56: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < char , int > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:47:56: note: expected a constant of type 'int', got 'int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:52:57: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < char , long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:52:57: note: expected a constant of type 'int', got 'long int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:57:62: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < char , long long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:57:62: note: expected a constant of type 'int', got 'long long int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:62:58: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < short , char > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:62:58: note: expected a constant of type 'int', got 'char'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:67:59: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < short , short > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:67:59: note: expected a constant of type 'int', got 'short int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:72:57: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < short , int > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:72:57: note: expected a constant of type 'int', got 'int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:77:58: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < short , long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:77:58: note: expected a constant of type 'int', got 'long int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:82:63: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < short , long long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:82:63: note: expected a constant of type 'int', got 'long long int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:87:56: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < int , char > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:87:56: note: expected a constant of type 'int', got 'char'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:92:57: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < int , short > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:92:57: note: expected a constant of type 'int', got 'short int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:97:55: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < int , int > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:97:55: note: expected a constant of type 'int', got 'int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:102:56: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < int , long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:102:56: note: expected a constant of type 'int', got 'long int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:107:61: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < int , long long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:107:61: note: expected a constant of type 'int', got 'long long int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:112:57: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < long , char > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:112:57: note: expected a constant of type 'int', got 'char'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:117:58: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < long , short > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:117:58: note: expected a constant of type 'int', got 'short int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:122:56: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < long , int > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:122:56: note: expected a constant of type 'int', got 'int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:127:57: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < long , long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:127:57: note: expected a constant of type 'int', got 'long int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:132:62: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < long , long long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:132:62: note: expected a constant of type 'int', got 'long long int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:137:62: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < long long , char > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:137:62: note: expected a constant of type 'int', got 'char'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:142:63: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < long long , short > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:142:63: note: expected a constant of type 'int', got 'short int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:147:61: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < long long , int > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:147:61: note: expected a constant of type 'int', got 'int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:152:62: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < long long , long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:152:62: note: expected a constant of type 'int', got 'long int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:157:67: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < long long , long long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:157:67: note: expected a constant of type 'int', got 'long long int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:165:75: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned char , unsigned char > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:165:75: note: expected a constant of type 'int', got 'unsigned char'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:170:76: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned char , unsigned short > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:170:76: note: expected a constant of type 'int', got 'short unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:175:74: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned char , unsigned int > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:175:74: note: expected a constant of type 'int', got 'unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:180:75: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned char , unsigned long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:180:75: note: expected a constant of type 'int', got 'long unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:185:80: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned char , unsigned long long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:185:80: note: expected a constant of type 'int', got 'long long unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:190:76: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned short , unsigned char > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:190:76: note: expected a constant of type 'int', got 'unsigned char'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:195:77: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned short , unsigned short > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:195:77: note: expected a constant of type 'int', got 'short unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:200:75: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned short , unsigned int > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:200:75: note: expected a constant of type 'int', got 'unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:205:76: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned short , unsigned long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:205:76: note: expected a constant of type 'int', got 'long unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:210:81: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned short , unsigned long long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:210:81: note: expected a constant of type 'int', got 'long long unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:215:74: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned int , unsigned char > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:215:74: note: expected a constant of type 'int', got 'unsigned char'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:220:75: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned int , unsigned short > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:220:75: note: expected a constant of type 'int', got 'short unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:225:73: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned int , unsigned int > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:225:73: note: expected a constant of type 'int', got 'unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:230:74: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned int , unsigned long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:230:74: note: expected a constant of type 'int', got 'long unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:235:79: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned int , unsigned long long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:235:79: note: expected a constant of type 'int', got 'long long unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:240:75: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned long , unsigned char > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:240:75: note: expected a constant of type 'int', got 'unsigned char'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:245:76: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned long , unsigned short > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:245:76: note: expected a constant of type 'int', got 'short unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:250:74: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned long , unsigned int > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:250:74: note: expected a constant of type 'int', got 'unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:255:75: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned long , unsigned long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:255:75: note: expected a constant of type 'int', got 'long unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:260:80: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned long , unsigned long long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:260:80: note: expected a constant of type 'int', got 'long long unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:265:80: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned long long , unsigned char > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:265:80: note: expected a constant of type 'int', got 'unsigned char'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:270:81: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned long long , unsigned short > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:270:81: note: expected a constant of type 'int', got 'short unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:275:79: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned long long , unsigned int > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:275:79: note: expected a constant of type 'int', got 'unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:280:80: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned long long , unsigned long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:280:80: note: expected a constant of type 'int', got 'long unsigned int'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:285:85: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
template < > struct ArduinoUnitDoubleWide < unsigned long long , unsigned long long > {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:285:85: note: expected a constant of type 'int', got 'long long unsigned int'
In file included from /home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/Compare.h:3:0,
from /home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:12,
from sketch.ino:2:
sketch.ino: In member function 'virtual void test_case_1_intended_to_pass_and_fails_on_32_bit::once()':
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:293:104: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
#define ArduinoUnitArgTypes(X,Y) ArduinoUnitDoubleWide < ArduinoUnitArgType(X) , ArduinoUnitArgType(Y) >
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:569:31: note: in expansion of macro 'ArduinoUnitArgTypes'
do { if (!Test::assertion< ArduinoUnitArgTypes(arg1,arg1)::A , ArduinoUnitArgTypes(arg1,arg2)::B > (ARDUINO_UNIT_STRING(__FILE__),__LINE__,ARDUINO_UNIT_STRING(#arg1),(arg1),ARDUINO_UNIT_STRING(op_name),op,ARDUINO_UNIT_STRING(#arg2),(arg2),message)) return; } while (0)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:572:40: note: in expansion of macro 'assertOpMsg'
#define assertOp_4(a1,op,op_name,arg2) assertOpMsg(a1,op,op_name,arg2,&Test::noMessage)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:596:42: note: in expansion of macro 'assertOp_4'
#define assertMore_2(a,b) assertOp_4(a,compareMore,">",b)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:23:52: note: in expansion of macro 'assertMore_2'
#define ArduinoUnitMacroArgs3(null,a1,a2,a3,f,...) f
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:30:42: note: in expansion of macro 'ArduinoUnitMacroArgs3'
#define ArduinoUnitMacroRecompose3(args) ArduinoUnitMacroArgs3 args
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:37:40: note: in expansion of macro 'ArduinoUnitMacroRecompose3'
#define ArduinoUnitMacroChoose3(f,...) ArduinoUnitMacroRecompose3((null,##__VA_ARGS__,f ## 3, f ## 2,f ## 1, f ## 0,))
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:598:25: note: in expansion of macro 'ArduinoUnitMacroChoose3'
#define assertMore(...) ArduinoUnitMacroChoose3(assertMore_, ## __VA_ARGS__)(__VA_ARGS__)
^
sketch.ino:45:3: note: in expansion of macro 'assertMore'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:293:104: note: expected a constant of type 'int', got 'ArduinoUnitWiden<int>::type {aka int}'
#define ArduinoUnitArgTypes(X,Y) ArduinoUnitDoubleWide < ArduinoUnitArgType(X) , ArduinoUnitArgType(Y) >
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:569:31: note: in expansion of macro 'ArduinoUnitArgTypes'
do { if (!Test::assertion< ArduinoUnitArgTypes(arg1,arg1)::A , ArduinoUnitArgTypes(arg1,arg2)::B > (ARDUINO_UNIT_STRING(__FILE__),__LINE__,ARDUINO_UNIT_STRING(#arg1),(arg1),ARDUINO_UNIT_STRING(op_name),op,ARDUINO_UNIT_STRING(#arg2),(arg2),message)) return; } while (0)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:572:40: note: in expansion of macro 'assertOpMsg'
#define assertOp_4(a1,op,op_name,arg2) assertOpMsg(a1,op,op_name,arg2,&Test::noMessage)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:596:42: note: in expansion of macro 'assertOp_4'
#define assertMore_2(a,b) assertOp_4(a,compareMore,">",b)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:23:52: note: in expansion of macro 'assertMore_2'
#define ArduinoUnitMacroArgs3(null,a1,a2,a3,f,...) f
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:30:42: note: in expansion of macro 'ArduinoUnitMacroArgs3'
#define ArduinoUnitMacroRecompose3(args) ArduinoUnitMacroArgs3 args
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:37:40: note: in expansion of macro 'ArduinoUnitMacroRecompose3'
#define ArduinoUnitMacroChoose3(f,...) ArduinoUnitMacroRecompose3((null,##__VA_ARGS__,f ## 3, f ## 2,f ## 1, f ## 0,))
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:598:25: note: in expansion of macro 'ArduinoUnitMacroChoose3'
#define assertMore(...) ArduinoUnitMacroChoose3(assertMore_, ## __VA_ARGS__)(__VA_ARGS__)
^
sketch.ino:45:3: note: in expansion of macro 'assertMore'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:293:104: error: type/value mismatch at argument 2 in template parameter list for 'template<class _A, int <anonymous> > struct ArduinoUnitDoubleWide'
#define ArduinoUnitArgTypes(X,Y) ArduinoUnitDoubleWide < ArduinoUnitArgType(X) , ArduinoUnitArgType(Y) >
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:569:67: note: in expansion of macro 'ArduinoUnitArgTypes'
do { if (!Test::assertion< ArduinoUnitArgTypes(arg1,arg1)::A , ArduinoUnitArgTypes(arg1,arg2)::B > (ARDUINO_UNIT_STRING(__FILE__),__LINE__,ARDUINO_UNIT_STRING(#arg1),(arg1),ARDUINO_UNIT_STRING(op_name),op,ARDUINO_UNIT_STRING(#arg2),(arg2),message)) return; } while (0)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:572:40: note: in expansion of macro 'assertOpMsg'
#define assertOp_4(a1,op,op_name,arg2) assertOpMsg(a1,op,op_name,arg2,&Test::noMessage)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:596:42: note: in expansion of macro 'assertOp_4'
#define assertMore_2(a,b) assertOp_4(a,compareMore,">",b)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:23:52: note: in expansion of macro 'assertMore_2'
#define ArduinoUnitMacroArgs3(null,a1,a2,a3,f,...) f
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:30:42: note: in expansion of macro 'ArduinoUnitMacroArgs3'
#define ArduinoUnitMacroRecompose3(args) ArduinoUnitMacroArgs3 args
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:37:40: note: in expansion of macro 'ArduinoUnitMacroRecompose3'
#define ArduinoUnitMacroChoose3(f,...) ArduinoUnitMacroRecompose3((null,##__VA_ARGS__,f ## 3, f ## 2,f ## 1, f ## 0,))
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:598:25: note: in expansion of macro 'ArduinoUnitMacroChoose3'
#define assertMore(...) ArduinoUnitMacroChoose3(assertMore_, ## __VA_ARGS__)(__VA_ARGS__)
^
sketch.ino:45:3: note: in expansion of macro 'assertMore'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnitUtility/ArduinoUnitWiden.h:293:104: note: expected a constant of type 'int', got 'ArduinoUnitWiden<int>::type {aka int}'
#define ArduinoUnitArgTypes(X,Y) ArduinoUnitDoubleWide < ArduinoUnitArgType(X) , ArduinoUnitArgType(Y) >
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:569:67: note: in expansion of macro 'ArduinoUnitArgTypes'
do { if (!Test::assertion< ArduinoUnitArgTypes(arg1,arg1)::A , ArduinoUnitArgTypes(arg1,arg2)::B > (ARDUINO_UNIT_STRING(__FILE__),__LINE__,ARDUINO_UNIT_STRING(#arg1),(arg1),ARDUINO_UNIT_STRING(op_name),op,ARDUINO_UNIT_STRING(#arg2),(arg2),message)) return; } while (0)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:572:40: note: in expansion of macro 'assertOpMsg'
#define assertOp_4(a1,op,op_name,arg2) assertOpMsg(a1,op,op_name,arg2,&Test::noMessage)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:596:42: note: in expansion of macro 'assertOp_4'
#define assertMore_2(a,b) assertOp_4(a,compareMore,">",b)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:23:52: note: in expansion of macro 'assertMore_2'
#define ArduinoUnitMacroArgs3(null,a1,a2,a3,f,...) f
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:30:42: note: in expansion of macro 'ArduinoUnitMacroArgs3'
#define ArduinoUnitMacroRecompose3(args) ArduinoUnitMacroArgs3 args
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:37:40: note: in expansion of macro 'ArduinoUnitMacroRecompose3'
#define ArduinoUnitMacroChoose3(f,...) ArduinoUnitMacroRecompose3((null,##__VA_ARGS__,f ## 3, f ## 2,f ## 1, f ## 0,))
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:598:25: note: in expansion of macro 'ArduinoUnitMacroChoose3'
#define assertMore(...) ArduinoUnitMacroChoose3(assertMore_, ## __VA_ARGS__)(__VA_ARGS__)
^
sketch.ino:45:3: note: in expansion of macro 'assertMore'
In file included from sketch.ino:2:0:
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:569:250: error: no matching function for call to 'test_case_1_intended_to_pass_and_fails_on_32_bit::assertion(const char*, int, const char*, int, const char*, <unresolved overloaded function type>, const char*, int&, void (*)(bool))'
do { if (!Test::assertion< ArduinoUnitArgTypes(arg1,arg1)::A , ArduinoUnitArgTypes(arg1,arg2)::B > (ARDUINO_UNIT_STRING(__FILE__),__LINE__,ARDUINO_UNIT_STRING(#arg1),(arg1),ARDUINO_UNIT_STRING(op_name),op,ARDUINO_UNIT_STRING(#arg2),(arg2),message)) return; } while (0)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:572:40: note: in expansion of macro 'assertOpMsg'
#define assertOp_4(a1,op,op_name,arg2) assertOpMsg(a1,op,op_name,arg2,&Test::noMessage)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:596:42: note: in expansion of macro 'assertOp_4'
#define assertMore_2(a,b) assertOp_4(a,compareMore,">",b)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:23:52: note: in expansion of macro 'assertMore_2'
#define ArduinoUnitMacroArgs3(null,a1,a2,a3,f,...) f
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:30:42: note: in expansion of macro 'ArduinoUnitMacroArgs3'
#define ArduinoUnitMacroRecompose3(args) ArduinoUnitMacroArgs3 args
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:37:40: note: in expansion of macro 'ArduinoUnitMacroRecompose3'
#define ArduinoUnitMacroChoose3(f,...) ArduinoUnitMacroRecompose3((null,##__VA_ARGS__,f ## 3, f ## 2,f ## 1, f ## 0,))
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:598:25: note: in expansion of macro 'ArduinoUnitMacroChoose3'
#define assertMore(...) ArduinoUnitMacroChoose3(assertMore_, ## __VA_ARGS__)(__VA_ARGS__)
^
sketch.ino:45:3: note: in expansion of macro 'assertMore'
In file included from sketch.ino:2:0:
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:489:17: note: candidate: template<class A, class B, class F> static bool Test::assertion(const char*, uint16_t, const char*, const A&, const char*, bool (*)(const A&, const B&), const char*, const B&, const F&)
static bool assertion(ARDUINO_UNIT_DECLARE_STRING file, uint16_t line, ARDUINO_UNIT_DECLARE_STRING lhss, const A& lhs, ARDUINO_UNIT_DECLARE_STRING ops, bool (*op)(const A& lhs, const B& rhs), ARDUINO_UNIT_DECLARE_STRING rhss, const B& rhs, const F &onMessage) {
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:489:17: note: template argument deduction/substitution failed:
In file included from sketch.ino:2:0:
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:569:250: error: template argument 1 is invalid
do { if (!Test::assertion< ArduinoUnitArgTypes(arg1,arg1)::A , ArduinoUnitArgTypes(arg1,arg2)::B > (ARDUINO_UNIT_STRING(__FILE__),__LINE__,ARDUINO_UNIT_STRING(#arg1),(arg1),ARDUINO_UNIT_STRING(op_name),op,ARDUINO_UNIT_STRING(#arg2),(arg2),message)) return; } while (0)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:572:40: note: in expansion of macro 'assertOpMsg'
#define assertOp_4(a1,op,op_name,arg2) assertOpMsg(a1,op,op_name,arg2,&Test::noMessage)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:596:42: note: in expansion of macro 'assertOp_4'
#define assertMore_2(a,b) assertOp_4(a,compareMore,">",b)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:23:52: note: in expansion of macro 'assertMore_2'
#define ArduinoUnitMacroArgs3(null,a1,a2,a3,f,...) f
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:30:42: note: in expansion of macro 'ArduinoUnitMacroArgs3'
#define ArduinoUnitMacroRecompose3(args) ArduinoUnitMacroArgs3 args
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:37:40: note: in expansion of macro 'ArduinoUnitMacroRecompose3'
#define ArduinoUnitMacroChoose3(f,...) ArduinoUnitMacroRecompose3((null,##__VA_ARGS__,f ## 3, f ## 2,f ## 1, f ## 0,))
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:598:25: note: in expansion of macro 'ArduinoUnitMacroChoose3'
#define assertMore(...) ArduinoUnitMacroChoose3(assertMore_, ## __VA_ARGS__)(__VA_ARGS__)
^
sketch.ino:45:3: note: in expansion of macro 'assertMore'
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:569:250: error: template argument 2 is invalid
do { if (!Test::assertion< ArduinoUnitArgTypes(arg1,arg1)::A , ArduinoUnitArgTypes(arg1,arg2)::B > (ARDUINO_UNIT_STRING(__FILE__),__LINE__,ARDUINO_UNIT_STRING(#arg1),(arg1),ARDUINO_UNIT_STRING(op_name),op,ARDUINO_UNIT_STRING(#arg2),(arg2),message)) return; } while (0)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:572:40: note: in expansion of macro 'assertOpMsg'
#define assertOp_4(a1,op,op_name,arg2) assertOpMsg(a1,op,op_name,arg2,&Test::noMessage)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:596:42: note: in expansion of macro 'assertOp_4'
#define assertMore_2(a,b) assertOp_4(a,compareMore,">",b)
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:23:52: note: in expansion of macro 'assertMore_2'
#define ArduinoUnitMacroArgs3(null,a1,a2,a3,f,...) f
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:30:42: note: in expansion of macro 'ArduinoUnitMacroArgs3'
#define ArduinoUnitMacroRecompose3(args) ArduinoUnitMacroArgs3 args
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:37:40: note: in expansion of macro 'ArduinoUnitMacroRecompose3'
#define ArduinoUnitMacroChoose3(f,...) ArduinoUnitMacroRecompose3((null,##__VA_ARGS__,f ## 3, f ## 2,f ## 1, f ## 0,))
^
/home/brian/dev/arduino/libraries/ArduinoUnit/src/ArduinoUnit.h:598:25: note: in expansion of macro 'ArduinoUnitMacroChoose3'
#define assertMore(...) ArduinoUnitMacroChoose3(assertMore_, ## __VA_ARGS__)(__VA_ARGS__)
^
sketch.ino:45:3: note: in expansion of macro 'assertMore'
Error compiling for board Teensy LC.
Ok, didn't foresee that. I have some automation of builds now for uno/mega/esp8266. How do I build for teensy? I don't see that as an option... Try the latest in this branch....
Summary
The following problems were observed in latest code on
master
. Some (maybe all) of these problems were also observed in 2.2.0, but I don't recall if the behavior was exactly the same. The code shown below was tested on an Arduino Nano (ATmega328P), a Teensy LC (ARM Cortex-M0+, 32-bit), and a NodeMCU v1.0 (ESP8266, 32-bit).Problem 1: With the default compiler warning settings, the compiler warnings about integer type mismatch are not printed. The
assertXxx()
sometimes produces unexpected results for non-portable code.Expected result: A compile time failure would be preferable, since assert statements with mixed integer types are often non-portable and doesn't do what the user actually intended.
Problem 2:
assertLess()
produces an incorrect result on 32-bit processors.Expected result:
assertLess()
should behave exactly like its equivalentif-statement
counterpart on a 32-bit processor.Preamble
In the revised templatized code in 2.3.x, the various
assertXxx()
macros eventually evaluate to the templatizedassertion()
method:which takes an instance of one of the templatized
compareXxx()
methods in:The problem occurs when the type of
A
andB
are mixed signed and unsigned integers, and of different sizes.Problems
Problem 1
With the compiler warning setting at "Default" (which I believe is the default), there is no warning printed about comparing signed and unsigned integers, which may not do what the user intended. At the "All" setting, we get the following, but I think most people would not see these warnings:
The following is the sample test case that generates this warning, which is hidden for most users. In this case, we have a test that passes on (8-bit) AVR, but fails on a 32-bit processor. You could argue that it's not ArduinoUnit's fault that the user wrote non-portable code. That's true, but I also think that dev tools should help users detect such conditions, and the fact that ArduinoUnit accepts this code (silently with the default "Default" compiler warnings setting) is somewhat unfortunate.
Running the above produces the following output on AVR:
and the following on both ARM and ESP8266:
Problem 2
This is a more serious problem than Problem 1. There's something wrong with the
assertLess()
method on a 32-bit processor, because it produces the wrong result. (OtherassertXxx()
methods may be affected, but I haven't tested them.)My expectation is that an
assertLess(a, b)
should produce the same result as thisstatement. The following code shows that this expectation is true on AVR, but fails on a 32-bit processor.
I haven't spent much time digging through your new templatized versions of the
assertXxx()
andcompareXxx()
macros to figure out what's going on. Hopefully you will have better insights. Here's the code:On an AVR, this produces the following, which is expected, with a caveat:
The assertion result is correct (failed), but the assertion message is misleading, because it says that
(end - start=-1) < (limit=30)
which is actually atrue
expression and should have passed. (My guess is that the there was an internal conversion to unsigned int, which caused the expression to befalse
, even through it's printed to betrue
.)On ARM and ESP8266, the
assertLess()
fails, which is unexpected and I think incorrect result, because the if-statement evaluates totrue
, so I would expect that theassertLess()
should evaluate totrue
, but it fails and produces this result:Comments
I suppose we could suggest to developers to avoid mixing signed and unsigned types, and mixing different integer sizes. I'm not sure that's practical. Maybe that suggestion works in a desktop or server environment, but in an embedded environment, I find myself using a variety of integer sizes to maximize static memory efficiency. And I find myself taking advantage of 2's complement unsigned rollovers quite often, to avoid having to use a larger integer type.
I also think the problems discussed here point to the advantages and necessity of running unit tests on the embedded environment itself, over running the tests on mocked out desktop or cloud environment. We can't really be sure something works until it compiles and runs on the target embedded environment.
Quick aside: I made the deliberate decision to try to avoid these problems in AUnit by requiring the two arguments in
assertXxx()
to be identical (except for "string" types). AUnit produces a compile-time error (which unfortunately is somewhat lengthy and obtuse) if the types are not identical. I'm not saying that this was a better design choice, but just wanted to point out an alternative.