From ac9e8f43de97e9d4dd3d62e42b7f60c1c9b0baab Mon Sep 17 00:00:00 2001 From: JiXieShi Date: Fri, 21 Jun 2024 15:33:39 +0800 Subject: [PATCH] UP --- demo/list/test.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/demo/list/test.c b/demo/list/test.c index f6e091d..6215c98 100644 --- a/demo/list/test.c +++ b/demo/list/test.c @@ -118,4 +118,27 @@ void Test_Queue() { // 打印出队的值 printf("Pop value from front: %d\n", *popVal1); printf("Pop value from rear: %c\n", *popVal2); + + float val3 = 10.5; + pushFirst(deque, &val3); // 将10.5插入队首 + double val4 = 20.5; + pushLast(deque, &val4); // 将20.5插入队尾 + float *popVal3 = (float *) popFirst(deque); // 从队首出队 + double *popVal4 = (double *) popLast(deque); // 从队尾出队 + printf("Pop value from front: %f\n", *popVal3); + printf("Pop value from rear: %lf\n", *popVal4); + + int nums[] = {10, 20, 30, 40, 50}; + // 测试入队操作 + for (int i = 0; i < 5; i++) { + pushFirst(deque, &nums[i]); // 将数组元素插入队首 + } + + // 测试出队操作 + int *popVal; + for (int i = 0; i < 5; i++) { + popVal = (int *) popFirst(deque); // 从队首出队 + printf("Pop value from front: %d\n", *popVal); + } + delQueue_List(deque); } \ No newline at end of file