From 0a421eb1cb942229d9c0ea35f54c8c677d8d5c26 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 20 Aug 2025 15:34:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=20seq?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/xy.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/test/xy.c b/test/xy.c index a3b57f9..98ebc1b 100644 --- a/test/xy.c +++ b/test/xy.c @@ -1,19 +1,24 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: MIT * ------------------------------------------------------------- - * File Name : xy.c - * File Authors : Aoran Zeng - * Contributors : Nil Null - * | Mikachu2333 - * | + * Test File : xy.c + * Test Authors : 曾奥然 + * Contributors : Mikachu2333 * Created On : <2023-08-30> - * Last Modified : <2025-08-19> + * Last Modified : <2025-08-20> * * Test xy.h * ------------------------------------------------------------*/ #include "xy.h" +void +print_str (void *str) +{ + print ((char *) str); +} + + int main (int argc, char const *argv[]) { @@ -132,6 +137,18 @@ main (int argc, char const *argv[]) println (xy_normalize_path (" \n ~/haha/test/123 \n\r ")); assert_str (xy_normalize_path ("~/haha/test"), xy_parent_dir (" ~/haha/test/123")); + + + XySeq_t *seq = xy_seq_new (); + xy_seq_push (seq, "Hello"); + xy_seq_push (seq, "World"); + assert_str ("Hello", xy_seq_at (seq, 1)); + assert_str ("World", xy_seq_at (seq, 2)); + xy_seq_each (seq, print_str); + xy_seq_pop (seq); + assert (1 == xy_seq_len (seq)); + + xy_succ ("测试完成", "xy.h 测试全部通过"); // xy_unimplemented();