11#include < ArduinoUnitTests.h>
22#include < Arduino.h>
33
4- unittest (millis_micros_and_delay)
4+ GodmodeState* state = GODMODE();
5+
6+ unittest_setup ()
57{
6- GodmodeState* state = GODMODE ();
78 state->reset ();
9+ }
10+
11+ unittest (millis_micros_and_delay)
12+ {
813 assertEqual (0 , millis ());
914 assertEqual (0 , micros ());
1015 delay (3 );
@@ -17,8 +22,6 @@ unittest(millis_micros_and_delay)
1722
1823unittest (random)
1924{
20- GodmodeState* state = GODMODE ();
21- state->reset ();
2225 randomSeed (1 );
2326 assertEqual (state->seed , 1 );
2427
@@ -36,8 +39,6 @@ unittest(random)
3639
3740unittest (pins)
3841{
39- GodmodeState* state = GODMODE ();
40- state->reset ();
4142 pinMode (1 , OUTPUT); // this is a no-op in unit tests. it's just here to prove compilation
4243 digitalWrite (1 , HIGH);
4344 assertEqual (HIGH, state->digitalPin [1 ]);
@@ -65,9 +66,6 @@ unittest(pins)
6566
6667unittest (pin_read_history)
6768{
68- GodmodeState* state = GODMODE ();
69- state->reset ();
70-
7169 int future[6 ] = {33 , 22 , 55 , 11 , 44 , 66 };
7270 state->analogPin [1 ].fromArray (future, 6 );
7371 for (int i = 0 ; i < 6 ; ++i)
@@ -92,8 +90,6 @@ unittest(pin_read_history)
9290
9391unittest (pin_write_history)
9492{
95- GodmodeState *state = GODMODE ();
96- state->reset ();
9793 int numMoved;
9894
9995 // history for digital pin
@@ -162,8 +158,6 @@ unittest(pin_write_history)
162158}
163159
164160unittest (spi) {
165- GodmodeState *state = GODMODE ();
166- state->reset ();
167161 assertEqual (" " , state->spi .dataIn );
168162 assertEqual (" " , state->spi .dataOut );
169163
@@ -215,7 +209,6 @@ unittest(spi) {
215209
216210 unittest (does_nothing_if_no_data)
217211 {
218- GodmodeState* state = GODMODE ();
219212 int myPin = 3 ;
220213 state->serialPort [0 ].dataIn = " " ;
221214 state->serialPort [0 ].dataOut = " " ;
@@ -227,7 +220,6 @@ unittest(spi) {
227220
228221 unittest (keeps_pin_low_and_acks)
229222 {
230- GodmodeState* state = GODMODE ();
231223 int myPin = 3 ;
232224 state->serialPort [0 ].dataIn = " 0" ;
233225 state->serialPort [0 ].dataOut = " " ;
@@ -240,7 +232,6 @@ unittest(spi) {
240232
241233 unittest (flips_pin_high_and_acks)
242234 {
243- GodmodeState* state = GODMODE ();
244235 int myPin = 3 ;
245236 state->serialPort [0 ].dataIn = " 1" ;
246237 state->serialPort [0 ].dataOut = " " ;
@@ -253,7 +244,6 @@ unittest(spi) {
253244
254245 unittest (two_flips)
255246 {
256- GodmodeState* state = GODMODE ();
257247 int myPin = 3 ;
258248 state->serialPort [0 ].dataIn = " 10junk" ;
259249 state->serialPort [0 ].dataOut = " " ;
0 commit comments