mirror of
https://github.com/RubyMetric/chsrc.git
synced 2024-11-23 07:23:30 +08:00
Format test_xy.c
This commit is contained in:
parent
0ef468f524
commit
a6dd3d755a
42
test_xy.c
42
test_xy.c
|
@ -3,7 +3,7 @@
|
||||||
* License : MIT
|
* License : MIT
|
||||||
* Authors : Aoran Zeng <ccmywish@qq.com>
|
* Authors : Aoran Zeng <ccmywish@qq.com>
|
||||||
* Created on : <2023-08-30>
|
* Created on : <2023-08-30>
|
||||||
* Last modified : <2023-09-29>
|
* Last modified : <2024-04-18>
|
||||||
*
|
*
|
||||||
* test_xy:
|
* test_xy:
|
||||||
*
|
*
|
||||||
|
@ -22,9 +22,10 @@ main (int argc, char const *argv[])
|
||||||
puts (xy_2strjoin ("Xi", "'an"));
|
puts (xy_2strjoin ("Xi", "'an"));
|
||||||
puts (xy_strjoin (2, "Xi", "'an"));
|
puts (xy_strjoin (2, "Xi", "'an"));
|
||||||
puts (xy_strjoin (3, "屈身守分,", "以待天时,", "不可与命争也"));
|
puts (xy_strjoin (3, "屈身守分,", "以待天时,", "不可与命争也"));
|
||||||
puts(xy_strjoin(4, "水落鱼梁浅,", "天寒梦泽深。", "羊公碑字在,", "读罢泪沾襟。"));
|
puts (xy_strjoin (4, "水落鱼梁浅,", "天寒梦泽深。", "羊公碑字在,",
|
||||||
puts(xy_strjoin(6, "楚山横地出,", "汉水接天回。", "冠盖非新里,", "章华即旧台。", "习池风景异,", "归路满尘埃。"));
|
"读罢泪沾襟。"));
|
||||||
|
puts (xy_strjoin (6, "楚山横地出,", "汉水接天回。", "冠盖非新里,",
|
||||||
|
"章华即旧台。", "习池风景异,", "归路满尘埃。"));
|
||||||
|
|
||||||
print (xy_str_to_bold ("粗体"));
|
print (xy_str_to_bold ("粗体"));
|
||||||
print (xy_str_to_faint ("浅体"));
|
print (xy_str_to_faint ("浅体"));
|
||||||
|
@ -55,28 +56,18 @@ main (int argc, char const *argv[])
|
||||||
assert (xy_str_start_with ("abcdef", "abcdef"));
|
assert (xy_str_start_with ("abcdef", "abcdef"));
|
||||||
assert (xy_str_start_with ("abcdef", ""));
|
assert (xy_str_start_with ("abcdef", ""));
|
||||||
|
|
||||||
assert_str("abcdefg",
|
assert_str ("abcdefg", xy_str_delete_suffix ("abcdefg", "cdef"));
|
||||||
xy_str_delete_suffix("abcdefg", "cdef"));
|
assert_str ("abcdefg", xy_str_delete_suffix ("abcdefg", "cdefgh"));
|
||||||
assert_str("abcdefg",
|
assert_str ("abcdefg", xy_str_delete_suffix ("abcdefg", ""));
|
||||||
xy_str_delete_suffix("abcdefg", "cdefgh"));
|
assert_str ("abcd", xy_str_delete_suffix ("abcdefg", "efg"));
|
||||||
assert_str("abcdefg",
|
|
||||||
xy_str_delete_suffix("abcdefg", ""));
|
|
||||||
assert_str("abcd",
|
|
||||||
xy_str_delete_suffix("abcdefg", "efg"));
|
|
||||||
|
|
||||||
assert_str("abcdefg",
|
assert_str ("abcdefg", xy_str_delete_prefix ("abcdefg", "cdef"));
|
||||||
xy_str_delete_prefix("abcdefg", "cdef"));
|
assert_str ("abcdefg", xy_str_delete_prefix ("abcdefg", "0abcde"));
|
||||||
assert_str("abcdefg",
|
assert_str ("abcdefg", xy_str_delete_prefix ("abcdefg", ""));
|
||||||
xy_str_delete_prefix("abcdefg", "0abcde"));
|
assert_str ("defg", xy_str_delete_prefix ("abcdefg", "abc"));
|
||||||
assert_str("abcdefg",
|
|
||||||
xy_str_delete_prefix("abcdefg", ""));
|
|
||||||
assert_str("defg",
|
|
||||||
xy_str_delete_prefix("abcdefg", "abc"));
|
|
||||||
|
|
||||||
assert_str("defdef",
|
assert_str ("defdef", xy_str_gsub ("abcdefabcdef", "abc", "")); // 删除
|
||||||
xy_str_gsub("abcdefabcdef", "abc", "")); // 删除
|
assert_str ("6def6def", xy_str_gsub ("abcdefabcdef", "abc", "6")); // 缩小
|
||||||
assert_str("6def6def",
|
|
||||||
xy_str_gsub("abcdefabcdef", "abc", "6")); // 缩小
|
|
||||||
assert_str ("XIANGdefXIANGdef",
|
assert_str ("XIANGdefXIANGdef",
|
||||||
xy_str_gsub ("abcdefabcdef", "abc", "XIANG")); // 扩张
|
xy_str_gsub ("abcdefabcdef", "abc", "XIANG")); // 扩张
|
||||||
assert_str ("DEFdefDEFdef",
|
assert_str ("DEFdefDEFdef",
|
||||||
|
@ -92,7 +83,8 @@ main (int argc, char const *argv[])
|
||||||
assert (false == xy_file_exist (xy_win_powershellv5_profile));
|
assert (false == xy_file_exist (xy_win_powershellv5_profile));
|
||||||
|
|
||||||
puts (xy_uniform_path (" \n ~/haha/test/123 \n\r "));
|
puts (xy_uniform_path (" \n ~/haha/test/123 \n\r "));
|
||||||
assert_str (xy_uniform_path("~/haha/test"), xy_parent_dir (" ~/haha/test/123") );
|
assert_str (xy_uniform_path ("~/haha/test"),
|
||||||
|
xy_parent_dir (" ~/haha/test/123"));
|
||||||
|
|
||||||
xy_success ("测试全部通过");
|
xy_success ("测试全部通过");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user