Add new unit tests

This commit is contained in:
Nick O'Leary
2014-02-06 21:23:13 +00:00
parent 989ca99594
commit 011171cfc3
13 changed files with 632 additions and 0 deletions

30
tests/src/lib/Buffer.cpp Normal file
View File

@ -0,0 +1,30 @@
#include "Buffer.h"
#include "Arduino.h"
Buffer::Buffer() {
}
Buffer::Buffer(uint8_t* buf, size_t size) {
this->add(buf,size);
}
bool Buffer::available() {
return this->pos < this->length;
}
uint8_t Buffer::next() {
if (this->available()) {
return this->buffer[this->pos++];
}
return 0;
}
void Buffer::reset() {
this->pos = 0;
}
void Buffer::add(uint8_t* buf, size_t size) {
uint16_t i = 0;
for (;i<size;i++) {
this->buffer[this->length++] = buf[i];
}
}