From 3710ce88088c00599c5b108456f6dde9a4d981bc Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期三, 08 七月 2020 18:09:58 +0800
Subject: [PATCH] commmit

---
 test/test_queue.c |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/test/test_queue.c b/test/test_queue.c
index fbc6e45..cb6ade7 100644
--- a/test/test_queue.c
+++ b/test/test_queue.c
@@ -1,7 +1,8 @@
 #include "test.h"
+
 using namespace std;
 
-int main () {
+void testStruct() {
 	unsigned int i = 0;
 	
 	int key = 2;
@@ -39,6 +40,54 @@
 	}
 
 	delete queue;
-	mm_destroy();
+}
 
+void testString() {
+	unsigned int i = 0;
+	std::ostringstream outstr;
+	int key = 2;
+
+	shmstring item;
+
+	size_t qsize = 16;
+  	//LockFreeQueue<struct Item> *queue = QueueFactory::createQueue<struct Item> (key, qsize);
+	SHMQueue<shmstring> *queue = new SHMQueue<shmstring>(key, 16);
+	// LockFreeQueue<struct Item> queue(16);
+	for(i = 0; i < qsize; i++) {
+		outstr.seekp(0);
+		outstr << "hello " << i ; 
+		if(queue->push(outstr.str().c_str())) {
+			 cout << i << " push锛�" << outstr.str() << endl;
+		}
+	}
+
+	// for(i = 0; i < qsize; i++) {
+		
+	// 	//queue.dequeue(item);
+		
+	// 	item = (*queue)[i];
+	// 	cout << "i=" << i << ":" << item << endl;
+	// }
+
+
+	 
+	struct timespec timeout = {1, 0};
+
+	i = 0;
+	while((queue->pop_timeout(item, &timeout)) ) {
+	    cout << i << " pop锛�" << item << endl;
+	   // cout <<  item.pic << endl;
+	    i++;
+	}
+
+	delete queue;
+}
+
+
+int main () {
+	testString();
+
+
+	mm_destroy();
+	return 0;
 }
\ No newline at end of file

--
Gitblit v1.8.0