测试 seq

This commit is contained in:
Aoran Zeng 2025-08-20 15:34:29 +08:00
parent b4e2a56abc
commit 0a421eb1cb
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98

View File

@ -1,19 +1,24 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: MIT
* -------------------------------------------------------------
* File Name : xy.c
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* | Mikachu2333 <mikachu.23333@zohomail.com>
* |
* Test File : xy.c
* Test Authors : <ccmywish@qq.com>
* Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
* 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();