AUnit
0.3.1
Unit testing framework for Arduino platforms inspired by ArduinoUnit.
|
A union of (const char*) and (const __FlashStringHelper*) with a discriminator. More...
#include <FCString.h>
Public Member Functions | |
FCString (const char *s) | |
FCString (const __FlashStringHelper *s) | |
uint8_t | getType () const |
const char * | getCString () const |
const __FlashStringHelper * | getFString () const |
Static Public Attributes | |
static const uint8_t | kCStringType = 0 |
static const uint8_t | kFStringType = 1 |
A union of (const char*) and (const __FlashStringHelper*) with a discriminator.
This allows us to treat these 2 strings like a single object. The major reason this class is needed is because the F() cannot be used outside a function, it can only be used inside a function, so we are forced to use normal c-strings instead of F() strings when manually creating Test or TestOnce instances.
I deliberately decided not to inherit from Printable. While it is convenient to be able to call Print::print() with an instance of this class, the cost is 2 (AVR) or 4 (Teensy-ARM or ESP8266) extra bytes of static memory for the v-table pointer for each instance. But each instance is only 3 (AVR) or 5 (Teensy-ARM or ESP8266) bytes big, so the cost of 50-100 bytes of static memory for a large suite of 25 unit tests does not seem worth the minor convenience.
Definition at line 50 of file FCString.h.