diff options
Diffstat (limited to 'tests/ringbuffer_test.cpp')
-rw-r--r-- | tests/ringbuffer_test.cpp | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/tests/ringbuffer_test.cpp b/tests/ringbuffer_test.cpp deleted file mode 100644 index 87b81c6..0000000 --- a/tests/ringbuffer_test.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include <iostream> -#include <cstring> -#include "raul/RingBuffer.hpp" - -using namespace std; -using namespace Raul; - -void -print_buf(size_t size, char* buf) -{ - cout << "{ "; - for (size_t i=0; i < size; ++i) { - cout << buf[i]; - if (i < size-1) - cout << ", "; - } - - cout << " }" << endl; -} - - -int -main() -{ - RingBuffer<char> rb(5); - - char ev[] = { 'a', 'b', 'c' }; - - rb.write(3, ev); - - char buf[3]; - rb.read(3, buf); - print_buf(3, buf); - - char ev2[] = { 'd', 'e', 'f' }; - rb.write(3, ev2); - - - size_t read = rb.read(3, buf); - if (read < 3) - rb.read(3 - read, buf + read); - - print_buf(3, buf); - - return 0; -} - |