From 6ebfb984ee2b7f66bef06b8a45c7e74c80ed24e2 Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Thu, 29 Sep 2016 21:14:42 +0200 Subject: [PATCH] Slightly more mock preparation, but most likely not going to finish it --- test/SegmentDisplayTestSuite.h | 15 ++++++++++++++- test/mock/Arduino.h | 4 ++-- test/mock/Mock.cpp | 12 ++++++------ test/mock/Mock.h | 4 ++++ 4 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 test/mock/Mock.h diff --git a/test/SegmentDisplayTestSuite.h b/test/SegmentDisplayTestSuite.h index c10a5e7..4ab8dea 100644 --- a/test/SegmentDisplayTestSuite.h +++ b/test/SegmentDisplayTestSuite.h @@ -1,4 +1,5 @@ #include +#include "Mock.h" #include "lib/SegmentDisplay.h" class SegmentDisplayTestSuite : public CxxTest::TestSuite @@ -11,10 +12,21 @@ class SegmentDisplayTestSuite : public CxxTest::TestSuite display->end(); } +/* void testWriteNumberFull(void) { + SegmentDisplay* display = new SegmentDisplay(); + display->begin(); + + display->setDigits(8); + display->writeNumber(12345678); + + display->end(); + + + // TODO test writing the full 8-digit numbers - TS_WARN("Not implemented"); + } void testWriteTextFull(void) @@ -46,4 +58,5 @@ class SegmentDisplayTestSuite : public CxxTest::TestSuite // TODO test writing text which is too long TS_WARN("Not implemented"); } +*/ }; \ No newline at end of file diff --git a/test/mock/Arduino.h b/test/mock/Arduino.h index 6f452b4..6548de2 100644 --- a/test/mock/Arduino.h +++ b/test/mock/Arduino.h @@ -24,8 +24,8 @@ static const uint8_t MISO = PIN_SPI_MISO; static const uint8_t SCK = PIN_SPI_SCK; -void digitalWrite( uint32_t dwPin, uint32_t dwVal ); -void pinMode( uint32_t dwPin, uint32_t dwMode ); +void digitalWrite(uint32_t dwPin, uint32_t dwVal); +void pinMode(uint32_t dwPin, uint32_t dwMode); void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val); #endif \ No newline at end of file diff --git a/test/mock/Mock.cpp b/test/mock/Mock.cpp index 57c21f3..eaf51ea 100644 --- a/test/mock/Mock.cpp +++ b/test/mock/Mock.cpp @@ -1,19 +1,19 @@ -// Provides hookable implementations for the mock headers +// Provides implementations for the mock headers that write out to a vector. +// Access this vector using Mock.h. #include "Arduino.h" +#include "Mock.h" -void digitalWrite( uint32_t dwPin, uint32_t dwVal ) + +void digitalWrite(uint32_t dwPin, uint32_t dwVal) { - } -void pinMode( uint32_t dwPin, uint32_t dwMode ) +void pinMode(uint32_t dwPin, uint32_t dwMode) { - } void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) { - } diff --git a/test/mock/Mock.h b/test/mock/Mock.h new file mode 100644 index 0000000..2ee8f88 --- /dev/null +++ b/test/mock/Mock.h @@ -0,0 +1,4 @@ +#ifndef Mock_h +#define Mock_h + +#endif \ No newline at end of file