IronGOLEM/tests/split.🗿

37 lines
840 B
Plaintext
Raw Permalink Normal View History

2023-06-18 13:42:57 -04:00
main()
{
local tab, reach_tab;
name = "split";
reach_tab = galloc(4);
[reach_tab] = "salut";
[reach_tab + 1] = "ca";
[reach_tab + 2] = "va";
[reach_tab + 3] = 0;
tab = split("salut ca va", " ");
test_tab_str(tab, reach_tab, "");
tab = split("salut ca va", " ");
test_tab_str(tab, reach_tab, "multiple delimiter past");
tab = split("salutbozocabozova", "bozo");
test_tab_str(tab, reach_tab, "mutiple char in delimiter");
[reach_tab] = "salut";
[reach_tab + 1] = 0;
tab = split("salut", "bozo");
test_tab_str(tab, reach_tab, "delimiter not in str");
[reach_tab] = "";
[reach_tab + 1] = 0;
tab = split("", "bozo");
test_tab_str(tab, reach_tab, "empty str");
[reach_tab] = "";
[reach_tab + 1] = 0;
tab = split("", "");
test_tab_str(tab, reach_tab, "empty delimiter and empty str🗿");
}