no message
parent
3802e5a66d
commit
eecb67b88a
|
@ -18,33 +18,40 @@ void TestRingBuffer(){
|
|||
}
|
||||
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++){
|
||||
std::cout<<"add "<<ret<<"\r\n"<<std::endl;
|
||||
for(uint32_t i = 0;i < x.Length();i++){
|
||||
printf("%d ",x.At(i));
|
||||
}
|
||||
|
||||
std::cout<<"\r\n----------------------------------"<<std::endl;
|
||||
x.SetEmpty();
|
||||
|
||||
ret = x.Add(in,516);
|
||||
std::cout<<"recv "<<ret<<"\r\n"<<std::endl;
|
||||
for(uint32_t i = 0;i < x.Size();i++){
|
||||
std::cout<<"add "<<ret<<"\r\n"<<std::endl;
|
||||
for(uint32_t i = 0;i < x.Length();i++){
|
||||
printf("%d ",x.At(i));
|
||||
}
|
||||
std::cout<<"\r\n----------------------------------"<<std::endl;
|
||||
|
||||
ret = x.Add(in,20);
|
||||
std::cout<<"recv "<<ret<<"\r\n"<<std::endl;
|
||||
for(uint32_t i = 0;i < x.Size();i++){
|
||||
std::cout<<"add "<<ret<<"\r\n"<<std::endl;
|
||||
for(uint32_t i = 0;i < x.Length();i++){
|
||||
printf("%d ",x.At(i));
|
||||
}
|
||||
std::cout<<"\r\n----------------------------------"<<std::endl;
|
||||
|
||||
ret = x.Copy(in,516);
|
||||
std::cout<<"\r\ncopy "<<ret<<"\r\n"<<std::endl;
|
||||
std::cout<<"\r\n----------------------------------"<<std::endl;
|
||||
for(uint32_t i = 0;i < ret;i++){
|
||||
printf("%d ",in[i]);
|
||||
}
|
||||
std::cout<<"\r\n----------------------------------"<<std::endl;
|
||||
ret = x.Take(in,516);
|
||||
std::cout<<"take "<<ret<<"\r\n"<<std::endl;
|
||||
for(uint32_t i = 0;i < ret;i++){
|
||||
printf("%d ",in[i]);
|
||||
}
|
||||
std::cout<<"\r\n----------------------------------"<<std::endl;
|
||||
ret = x.Take(in,20);
|
||||
std::cout<<"take "<<ret<<"\r\n"<<std::endl;
|
||||
for(uint32_t i = 0;i < ret;i++){
|
||||
|
@ -55,5 +62,6 @@ void TestRingBuffer(){
|
|||
|
||||
int main() {
|
||||
std::cout<<"main"<<std::endl;
|
||||
TestRingBuffer();
|
||||
|
||||
}
|
Loading…
Reference in New Issue