Cleanup tester.

This commit is contained in:
Francois Best 2014-02-13 22:05:52 +01:00
parent b2800e5fdd
commit dbc9d97345
3 changed files with 9 additions and 15 deletions

View File

@ -13,9 +13,6 @@ SoftwareSerial softSerial(10, 11);
MIDI_CREATE_INSTANCE(SoftwareSerial, softSerial, midiSW); MIDI_CREATE_INSTANCE(SoftwareSerial, softSerial, midiSW);
#endif #endif
// \todo Create instance for USB if available
void setupMidi() void setupMidi()
{ {
while (!softSerial.isListening()) while (!softSerial.isListening())

View File

@ -2,6 +2,3 @@
void setupTesters(); void setupTesters();
bool launchTests(); bool launchTests();

View File

@ -8,23 +8,23 @@
template<class SerialClass> template<class SerialClass>
class Tester class Tester
{ {
public: public:
typedef bool (*Functor) (MIDI_CLASS(SerialClass)&); typedef bool (*Functor) (MIDI_CLASS(SerialClass)&);
public: public:
explicit Tester(MIDI_CLASS(SerialClass)& inInstance) explicit Tester(MIDI_CLASS(SerialClass)& inInstance)
: mMidiInstance(inInstance) : mMidiInstance(inInstance)
, mProgress(0) , mProgress(0)
{ {
} }
void setup() void setup()
{ {
mProgress = 0; mProgress = 0;
mMidiInstance.begin(MIDI_CHANNEL_OMNI); mMidiInstance.begin(MIDI_CHANNEL_OMNI);
mMidiInstance.turnThruOff(); mMidiInstance.turnThruOff();
} }
public: public:
inline bool performTest(Functor inTestMethod) inline bool performTest(Functor inTestMethod)
{ {
@ -36,7 +36,7 @@ public:
} }
return false; return false;
} }
inline bool expect(bool inCondition) const inline bool expect(bool inCondition) const
{ {
Serial.print(testNames[mProgress]); Serial.print(testNames[mProgress]);
@ -53,7 +53,7 @@ public:
} }
return inCondition; return inCondition;
} }
bool run() bool run()
{ {
bool result = true; bool result = true;
@ -77,7 +77,7 @@ public:
result &= performTest(testSystemReset); result &= performTest(testSystemReset);
return result; return result;
} }
private: private:
MIDI_CLASS(SerialClass)& mMidiInstance; MIDI_CLASS(SerialClass)& mMidiInstance;
unsigned mProgress; unsigned mProgress;
@ -102,8 +102,8 @@ bool launchTests()
Serial.println("Testing HW:"); Serial.println("Testing HW:");
if (testerHW.run() == false) if (testerHW.run() == false)
return false; return false;
/*Serial.println("Testing SW:"); Serial.println("Testing SW:");
if (testerSW.run() == false) if (testerSW.run() == false)
return false;*/ return false;
return true; return true;
} }