no message

master
zcy 2021-05-15 01:25:14 +08:00
parent 85b23f1b5b
commit 2aef9ca853
2 changed files with 33 additions and 0 deletions

View File

@ -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));
}
}

View File

@ -0,0 +1,6 @@
#ifndef _TEST_TEMPLATE_
void TestRingBuffer();
#endif