mirror of
https://github.com/RubyMetric/chsrc
synced 2025-09-10 06:29:54 +08:00
测试 seq
This commit is contained in:
parent
b4e2a56abc
commit
0a421eb1cb
29
test/xy.c
29
test/xy.c
@ -1,19 +1,24 @@
|
|||||||
/** ------------------------------------------------------------
|
/** ------------------------------------------------------------
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
* -------------------------------------------------------------
|
* -------------------------------------------------------------
|
||||||
* File Name : xy.c
|
* Test File : xy.c
|
||||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
* Test Authors : 曾奥然 <ccmywish@qq.com>
|
||||||
* Contributors : Nil Null <nil@null.org>
|
* Contributors : Mikachu2333 <mikachu.23333@zohomail.com>
|
||||||
* | Mikachu2333 <mikachu.23333@zohomail.com>
|
|
||||||
* |
|
|
||||||
* Created On : <2023-08-30>
|
* Created On : <2023-08-30>
|
||||||
* Last Modified : <2025-08-19>
|
* Last Modified : <2025-08-20>
|
||||||
*
|
*
|
||||||
* Test xy.h
|
* Test xy.h
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "xy.h"
|
#include "xy.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
print_str (void *str)
|
||||||
|
{
|
||||||
|
print ((char *) str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char const *argv[])
|
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 "));
|
println (xy_normalize_path (" \n ~/haha/test/123 \n\r "));
|
||||||
assert_str (xy_normalize_path ("~/haha/test"), xy_parent_dir (" ~/haha/test/123"));
|
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_succ ("测试完成", "xy.h 测试全部通过");
|
||||||
|
|
||||||
// xy_unimplemented();
|
// xy_unimplemented();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user