Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ianfixes/2018-01-25_ci
add CI, convert to Arduino library
- Loading branch information
Showing
8 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
compile: | ||
platforms: | ||
- uno | ||
|
||
unittest: | ||
platforms: | ||
- uno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.bin | ||
Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sudo: false | ||
language: ruby | ||
script: | ||
- bundle install | ||
- bundle exec arduino_ci_remote.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source 'https://rubygems.org' | ||
gem 'arduino_ci', '~> 0.1.7' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name=Queue | ||
version=0.0.1 | ||
author=Steven de Salas <steven@desalasworks.com> | ||
maintainer=Steven de Salas <steven@desalasworks.com> | ||
sentence=Generic C++ circular queue | ||
paragraph=Works for any datatype and desired length | ||
category=Data Storage | ||
url=https://github.com/sdesalas/Arduino-Queue.h | ||
architectures=* | ||
includes=Queue.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#include <ArduinoUnitTests.h> | ||
#include "../Queue.h" | ||
|
||
int testSize = 4; // number of elements we'll use in our test queues | ||
|
||
unittest(empty) | ||
{ | ||
Queue<int> queue(testSize); | ||
assertEqual(0, queue.count()); // initially empty | ||
assertEqual(0, queue.peek()); // 0 happens to be the default int val | ||
assertEqual(0, queue.pop()); | ||
assertEqual(0, queue.count()); // still empty | ||
} | ||
|
||
unittest(filling_and_emptying) | ||
{ | ||
Queue<int> queue(testSize); | ||
assertEqual(0, queue.count()); // initially empty | ||
for (int i = 1; i <= testSize; ++i) { | ||
queue.push(i * 11); | ||
assertEqual(i, queue.count()); // count increases with pushes | ||
} | ||
for (int i = 1; i <= testSize; ++i) { | ||
assertEqual(i * 11, queue.peek()); // verify FIFO | ||
assertEqual(testSize + 1 - i, queue.count()); // verify count unchanged | ||
assertEqual(i * 11, queue.pop()); // verify FIFO | ||
assertEqual(testSize - i, queue.count()); // verify count changed | ||
} | ||
} | ||
|
||
unittest(filling_and_clearing) | ||
{ | ||
Queue<int> queue(testSize); | ||
assertEqual(0, queue.count()); // initially empty | ||
for (int i = 1; i <= testSize; ++i) { | ||
queue.push(i * 11); | ||
assertEqual(i, queue.count()); // count increases with pushes | ||
} | ||
assertEqual(testSize, queue.count()); // now full | ||
queue.clear(); | ||
assertEqual(0, queue.count()); // again empty | ||
} | ||
|
||
unittest(overfilling) | ||
{ | ||
Queue<int> queue(testSize); | ||
assertEqual(0, queue.count()); // initially empty | ||
for (int i = 1; i <= testSize; ++i) { | ||
queue.push(i * 11); | ||
} | ||
assertEqual(testSize, queue.count()); // now full | ||
for (int i = (testSize + 1); i <= testSize * 2; ++i) { | ||
queue.push(i * 11); | ||
assertEqual(testSize, queue.count()); // still full | ||
} | ||
|
||
for (int i = 1; i <= testSize; ++i) { | ||
assertEqual(i * 11, queue.peek()); // verify FIFO | ||
assertEqual(testSize + 1 - i, queue.count()); // verify count unchanged | ||
assertEqual(i * 11, queue.pop()); // verify FIFO | ||
assertEqual(testSize - i, queue.count()); // verify count changed | ||
} | ||
} | ||
|
||
unittest(wrapping) | ||
{ | ||
Queue<int> queue(testSize); | ||
queue.push(0); // offset the queue so we have to wrap around | ||
queue.push(1); | ||
queue.pop(); | ||
queue.pop(); | ||
|
||
for (int i = 1; i <= testSize; ++i) { | ||
queue.push(i * 11); | ||
} | ||
assertEqual(testSize, queue.count()); // now full | ||
for (int i = (testSize + 1); i <= testSize * 2; ++i) { | ||
queue.push(i * 11); | ||
assertEqual(testSize, queue.count()); // still full | ||
} | ||
|
||
for (int i = 1; i <= testSize; ++i) { | ||
assertEqual(i * 11, queue.peek()); // verify FIFO | ||
assertEqual(testSize + 1 - i, queue.count()); // verify count unchanged | ||
assertEqual(i * 11, queue.pop()); // verify FIFO | ||
assertEqual(testSize - i, queue.count()); // verify count changed | ||
} | ||
} | ||
|
||
unittest_main() |