test_string_utils.c revision 1f3127e88a87953f059c9a70d3582ae1719594b1
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik Lukas Slebodnik <slebodnikl@redhat.com>
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik Copyright (C) 2014 Red Hat
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik This program is free software; you can redistribute it and/or modify
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik it under the terms of the GNU General Public License as published by
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik the Free Software Foundation; either version 3 of the License, or
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik (at your option) any later version.
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik This program is distributed in the hope that it will be useful,
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik but WITHOUT ANY WARRANTY; without even the implied warranty of
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik GNU General Public License for more details.
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik You should have received a copy of the GNU General Public License
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik along with this program. If not, see <http://www.gnu.org/licenses/>.
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik const char *input_str = "Lorem ipsum dolor sit amet";
1f3127e88a87953f059c9a70d3582ae1719594b1Jakub Hrozek res = sss_replace_space(mem_ctx, input_str, '\0');
1f3127e88a87953f059c9a70d3582ae1719594b1Jakub Hrozek res = sss_replace_space(mem_ctx, input_str, '\0');
1f3127e88a87953f059c9a70d3582ae1719594b1Jakub Hrozek res = sss_replace_space(mem_ctx, data_set[i].input,
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik assert_string_equal(res, data_set[i].output);
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik assert_true(check_leaks_pop(mem_ctx) == true);
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnikvoid test_reverse_replace_whitespaces(void **state)
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik char *input_str = discard_const_p(char, "Lorem ipsum dolor sit amet");
1f3127e88a87953f059c9a70d3582ae1719594b1Jakub Hrozek res = sss_reverse_replace_space(mem_ctx, input_str, '\0');
1f3127e88a87953f059c9a70d3582ae1719594b1Jakub Hrozek res = sss_reverse_replace_space(mem_ctx, input_str, '\0');
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik input_str = discard_const_p(char, data_set[i].input);
1f3127e88a87953f059c9a70d3582ae1719594b1Jakub Hrozek res = sss_reverse_replace_space(mem_ctx, input_str,
022c6b90bb37851c0e8704c0e5388ebc113c6470Lukas Slebodnik assert_string_equal(res, data_set[i].output);