diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2013-02-27 13:55:08 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2013-02-27 13:55:08 +0000 |
commit | 4f3cdfaf5e4d67702237ed499ca0f0b89644b6ac (patch) | |
tree | 8e6b6d7d8db2e6afdc111e4ddf42ee59d19cb3e8 /ACE/tests/Wild_Match_Test.cpp | |
parent | 596a222c79c223733d1544f718e57768743d7936 (diff) | |
download | ATCD-4f3cdfaf5e4d67702237ed499ca0f0b89644b6ac.tar.gz |
Wed Feb 27 13:54:27 UTC 2013 Johnny Willemsen <jwillemsen@remedy.nl>
* tests/Wild_Match_Test.cpp:
Extended this test to get 100% coverage for ACE::wild_match,
resolves
Coverity 753117
Diffstat (limited to 'ACE/tests/Wild_Match_Test.cpp')
-rw-r--r-- | ACE/tests/Wild_Match_Test.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ACE/tests/Wild_Match_Test.cpp b/ACE/tests/Wild_Match_Test.cpp index 5e4e7424455..387f6324b8f 100644 --- a/ACE/tests/Wild_Match_Test.cpp +++ b/ACE/tests/Wild_Match_Test.cpp @@ -1,11 +1,12 @@ // $Id$ #include "ace/ACE.h" +#include "ace/Log_Msg.h" #include "test_config.h" bool match (const char *str, const char *pat, bool cs = true, bool cc = false) { - bool result = ACE::wild_match (str, pat, cs, cc); + bool const result = ACE::wild_match (str, pat, cs, cc); ACE_DEBUG ((LM_DEBUG, "string {%C} %C pattern {%s}\t%C\t%C\n", str, (result ? "matches" : "does not match"), pat, (cs ? "" : "case-insensitive"), (cc ? "char classes" : ""))); @@ -36,6 +37,7 @@ int run_main (int, ACE_TCHAR *[]) ok &= !match ("C2", "?[!2]", true, true); ok &= match ("C1", "?[!2]", true, true); + ok &= !match (0, "[!C]?", true, true); // invalid classes: results are undefined but we shouldn't crash match ("foo", "f[o-a]o", true, true); @@ -44,6 +46,11 @@ int run_main (int, ACE_TCHAR *[]) match ("bar", "[]x", true, true); match ("foo", "[f-f]oo", true, true); + if (!ok) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Wild_Match_Test failed\n"))); + } + ACE_END_TEST; return ok ? 0 : 1; } |