diff options
author | Alberto Gonzalez Iniesta <agi@inittab.org> | 2016-12-27 18:25:47 +0100 |
---|---|---|
committer | Alberto Gonzalez Iniesta <agi@inittab.org> | 2016-12-27 18:25:47 +0100 |
commit | 3a2bbdb05ca6a6996e424c9fb225cb0d53804125 (patch) | |
tree | f29063da5bec4caf3853d49a22a09c8619eebd21 /tests/unit_tests/plugins/auth-pam | |
parent | d53dba59e78da865c4fe820386ff2f4f76925f3b (diff) |
New upstream version 2.4.0upstream/2.4.0
Diffstat (limited to 'tests/unit_tests/plugins/auth-pam')
-rw-r--r-- | tests/unit_tests/plugins/auth-pam/Makefile.in | 6 | ||||
-rw-r--r-- | tests/unit_tests/plugins/auth-pam/test_search_and_replace.c | 71 |
2 files changed, 42 insertions, 35 deletions
diff --git a/tests/unit_tests/plugins/auth-pam/Makefile.in b/tests/unit_tests/plugins/auth-pam/Makefile.in index 34156b5..dfe7eba 100644 --- a/tests/unit_tests/plugins/auth-pam/Makefile.in +++ b/tests/unit_tests/plugins/auth-pam/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -434,14 +434,14 @@ distclean-compile: @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff --git a/tests/unit_tests/plugins/auth-pam/test_search_and_replace.c b/tests/unit_tests/plugins/auth-pam/test_search_and_replace.c index 70e472f..e80bffb 100644 --- a/tests/unit_tests/plugins/auth-pam/test_search_and_replace.c +++ b/tests/unit_tests/plugins/auth-pam/test_search_and_replace.c @@ -8,63 +8,70 @@ #include "utils.h" -static void pass_any_null_param__returns_null() { +static void +pass_any_null_param__returns_null() { - char DUMMY[] = "DUMMY"; + char DUMMY[] = "DUMMY"; - assert_null(searchandreplace(NULL,DUMMY,DUMMY)); - assert_null(searchandreplace(DUMMY,NULL,DUMMY)); - assert_null(searchandreplace(DUMMY,DUMMY,NULL)); + assert_null(searchandreplace(NULL,DUMMY,DUMMY)); + assert_null(searchandreplace(DUMMY,NULL,DUMMY)); + assert_null(searchandreplace(DUMMY,DUMMY,NULL)); } -static void pass_any_empty_string__returns_null() { +static void +pass_any_empty_string__returns_null() { - char DUMMY[] = "DUMMY"; - char EMPTY[] = ""; + char DUMMY[] = "DUMMY"; + char EMPTY[] = ""; - assert_null(searchandreplace(EMPTY,DUMMY,DUMMY)); - assert_null(searchandreplace(DUMMY,EMPTY,DUMMY)); - assert_null(searchandreplace(DUMMY,DUMMY,EMPTY)); + assert_null(searchandreplace(EMPTY,DUMMY,DUMMY)); + assert_null(searchandreplace(DUMMY,EMPTY,DUMMY)); + assert_null(searchandreplace(DUMMY,DUMMY,EMPTY)); } -static void replace_single_char__one_time__match_is_replaced() { - char *replaced = searchandreplace("X","X","Y"); +static void +replace_single_char__one_time__match_is_replaced() { + char *replaced = searchandreplace("X","X","Y"); - assert_non_null(replaced); - assert_string_equal("Y", replaced); + assert_non_null(replaced); + assert_string_equal("Y", replaced); - free(replaced); + free(replaced); } -static void replace_single_char__multiple_times__match_all_matches_are_replaced() { - char *replaced = searchandreplace("XaX","X","Y"); +static void +replace_single_char__multiple_times__match_all_matches_are_replaced() { + char *replaced = searchandreplace("XaX","X","Y"); - assert_non_null(replaced); - assert_string_equal ("YaY", replaced); + assert_non_null(replaced); + assert_string_equal("YaY", replaced); - free(replaced); + free(replaced); } -static void replace_longer_text__multiple_times__match_all_matches_are_replaced() { - char *replaced = searchandreplace("XXaXX","XX","YY"); +static void +replace_longer_text__multiple_times__match_all_matches_are_replaced() { + char *replaced = searchandreplace("XXaXX","XX","YY"); - assert_non_null(replaced); - assert_string_equal ("YYaYY", replaced); + assert_non_null(replaced); + assert_string_equal("YYaYY", replaced); - free(replaced); + free(replaced); } -static void pattern_not_found__returns_original() { - char *replaced = searchandreplace("abc","X","Y"); +static void +pattern_not_found__returns_original() { + char *replaced = searchandreplace("abc","X","Y"); - assert_non_null(replaced); - assert_string_equal ("abc", replaced); + assert_non_null(replaced); + assert_string_equal("abc", replaced); - free(replaced); + free(replaced); } -int main(void) { +int +main(void) { const struct CMUnitTest tests[] = { cmocka_unit_test(pass_any_null_param__returns_null), cmocka_unit_test(pass_any_empty_string__returns_null), |