no message
parent
85b23f1b5b
commit
2aef9ca853
|
@ -0,0 +1,27 @@
|
||||||
|
#include "iostream"
|
||||||
|
#include <vector>
|
||||||
|
#include "pattern/ringbuffer.hpp"
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void TestRingBuffer(){
|
||||||
|
int in[1024];
|
||||||
|
for(int i = 0;i < 1024;i ++){
|
||||||
|
in[i] = i;
|
||||||
|
}
|
||||||
|
RingBuffer<int> x(1024);
|
||||||
|
int ret = x.Add(in,512);
|
||||||
|
|
||||||
|
std::cout<<"recv "<<ret<<"\r\n"<<std::endl;
|
||||||
|
for(uint32_t i = 0;i < x.Size();i++){
|
||||||
|
printf("%d ",x.At(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
x.SetEmpty();
|
||||||
|
ret = x.Add(in,1024);
|
||||||
|
std::cout<<"recv "<<ret<<"\r\n"<<std::endl;
|
||||||
|
for(uint32_t i = 0;i < x.Size();i++){
|
||||||
|
printf("%d ",x.At(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef _TEST_TEMPLATE_
|
||||||
|
|
||||||
|
|
||||||
|
void TestRingBuffer();
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue