chsrc/test_xy.c

80 lines
2.6 KiB
C
Raw Normal View History

2023-09-09 16:57:06 +08:00
/** ------------------------------------------------------------
* File : test_xy.c
* License : MIT
* Authors : Aoran Zeng <ccmywish@qq.com>
* Created on : <2023-08-30>
2023-09-26 19:16:38 +08:00
* Last modified : <2023-09-26>
2023-09-09 16:57:06 +08:00
*
* test_xy:
*
* xy.h
* ------------------------------------------------------------*/
2023-08-30 09:51:48 +08:00
2023-09-03 14:58:13 +08:00
#include "xy.h"
2023-08-30 09:51:48 +08:00
int
main (int argc, char const *argv[])
{
xy_useutf8();
2023-09-04 14:55:38 +08:00
puti(3);
double dbl = 3.1415;
putf(dbl);
2023-08-30 19:44:29 +08:00
puts(xy_2strjoin("Xi", "'an"));
puts(xy_strjoin (2, "Xi", "'an"));
puts(xy_strjoin(3, "屈身守分,", "以待天时,", "不可与命争也"));
puts(xy_strjoin(4, "水落鱼梁浅,", "天寒梦泽深。", "羊公碑字在,", "读罢泪沾襟。"));
puts(xy_strjoin(6, "楚山横地出,", "汉水接天回。", "冠盖非新里,", "章华即旧台。", "习池风景异,", "归路满尘埃。"));
2023-08-30 09:51:48 +08:00
2023-09-04 21:15:16 +08:00
2023-09-05 15:15:55 +08:00
puts(xy_str_to_bold("粗体"));
puts(xy_str_to_faint("浅体"));
puts(xy_str_to_italic("斜体"));
puts(xy_str_to_underline("下划线"));
puts(xy_str_to_blink("闪烁"));
puts(xy_str_to_cross("删除线"));
puts(xy_str_to_red("红色"));
puts(xy_str_to_green("绿色"));
puts(xy_str_to_yellow("黄色"));
puts(xy_str_to_blue("蓝色"));
puts(xy_str_to_magenta("紫色"));
puts(xy_str_to_purple("紫色"));
puts(xy_str_to_cyan("青色"));
2023-09-04 21:21:36 +08:00
putb(xy_str_end_with("abcdef", "abcdefg")); // false
putb(xy_str_end_with("abcdef", "def")); // true
putb(xy_str_end_with("abcdef", "bcdef")); // true
putb(xy_str_end_with("abcdef", "abcdef")); // true
putb(xy_str_end_with("abcdef", "")); // true
putb(xy_str_start_with("abcdef", "abcdefg")); // false
putb(xy_str_start_with("abcdef", "abc")); // true
putb(xy_str_start_with("abcdef", "abcde")); // true
putb(xy_str_start_with("abcdef", "abcdef")); // true
putb(xy_str_start_with("abcdef", "")); // true
2023-09-04 21:21:36 +08:00
puts(xy_str_delete_suffix("abcdefg", "cdef")); // 不变
puts(xy_str_delete_suffix("abcdefg", "cdefgh"));// 不变
puts(xy_str_delete_suffix("abcdefg", "")); // 不变
puts(xy_str_delete_suffix("abcdefg", "efg")); // abcd
2023-09-04 21:15:16 +08:00
puts(xy_str_delete_prefix("abcdefg", "cdef")); // 不变
puts(xy_str_delete_prefix("abcdefg", "0abcde"));// 不变
puts(xy_str_delete_prefix("abcdefg", "")); // 不变
puts(xy_str_delete_prefix("abcdefg", "abc")); // defg
2023-08-30 10:59:27 +08:00
xy_success("成功:输出成功内容");
xy_info("信息: 输出信息内容");
xy_warn("警告:输出警告内容");
xy_error("错误:输出错误内容");
2023-09-10 13:15:34 +08:00
putb(xy_file_exist("chsrc.png"));
2023-09-10 13:31:48 +08:00
putb(xy_file_exist(xy_win_powershell_profile));
putb(xy_file_exist(xy_win_powershellv5_profile));
2023-09-26 19:16:38 +08:00
2023-08-30 09:51:48 +08:00
return 0;
}