From 37e55d496d5fc6a331b6ea1b79cca7fd95bf1b81 Mon Sep 17 00:00:00 2001 From: maniacbug Date: Wed, 21 Dec 2011 14:44:02 -0800 Subject: [PATCH] Moved network startup into main(), so it only fires up the network ONCE. Compiles only, not tested. --- tests/unit/PingTest.test | 4 ---- tests/unit/SyncTest.test | 4 ---- tests/unit/runner.cpp | 26 +++++++++++++++++++------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/tests/unit/PingTest.test b/tests/unit/PingTest.test index 2d04cfa8..f17fd1ab 100644 --- a/tests/unit/PingTest.test +++ b/tests/unit/PingTest.test @@ -50,10 +50,6 @@ public: } void setUp() { - SPI.begin(); - radio.begin(); - network.begin(/* channel */100,/* this node */0); - // Reset remote to initial state RF24NetworkHeader header(/*to node*/ 1, /*type*/ 'R' /*Reset*/); network.write(header,0,0); diff --git a/tests/unit/SyncTest.test b/tests/unit/SyncTest.test index 5a0010ec..483a93a8 100644 --- a/tests/unit/SyncTest.test +++ b/tests/unit/SyncTest.test @@ -62,10 +62,6 @@ public: } void setUp() { - SPI.begin(); - radio.begin(); - network.begin(/* channel */100,/* this node */0); - pSync = new Sync(network); pSync->begin(/* other node*/ 1); p_sync_data = new(sync_data_t); diff --git a/tests/unit/runner.cpp b/tests/unit/runner.cpp index 04c19f63..5e590595 100644 --- a/tests/unit/runner.cpp +++ b/tests/unit/runner.cpp @@ -12,20 +12,32 @@ #include #include #include +#include + +#include +#include +#include extern void board_start(const char*); +extern RF24Network network; +extern RF24 radio; -int main( void ) { - CxxTest::ErrorPrinter tmp; +int main( void ) +{ + CxxTest::ErrorPrinter tmp; + while(1) + { board_start(__FILE__); + + SPI.begin(); + radio.begin(); + network.begin(/* channel */100,/* this node */0); CxxTest::Main( tmp, 0, NULL ); - printf("Tests complete. Stopping\r\n"); - while(1) - { - } + printf("Tests complete. Restarting...\r\n"); + } } -#include const char* CxxTest::RealWorldDescription::_worldName = "cxxtest"; +// vim:cin:ai:sts=2 sw=2 ft=cpp