diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-03-25 12:48:14 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-03-25 14:48:14 +0300 |
commit | e71262463f8fd2d9509b5646b4e08cfa09fc2889 (patch) | |
tree | 2902af0582c2d5a4e9815605fe7ec6ccf117e191 /src/test.cpp | |
parent | 26666bb36f594bbca8aa71654c009bbceb1e5eb8 (diff) | |
download | minetest-e71262463f8fd2d9509b5646b4e08cfa09fc2889.tar.xz |
Add removeStringEnd()
Diffstat (limited to 'src/test.cpp')
-rw-r--r-- | src/test.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test.cpp b/src/test.cpp index 6588f113c..1b9dfcb5d 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapsector.h" #include "settings.h" #include "log.h" +#include "utility_string.h" /* Asserts that the exception occurs @@ -120,6 +121,11 @@ struct TestUtilities assert(is_yes("YeS") == true); assert(is_yes("") == false); assert(is_yes("FAlse") == false); + const char *ends[] = {"abc", "c", "bc", NULL}; + assert(removeStringEnd("abc", ends) == ""); + assert(removeStringEnd("bc", ends) == "b"); + assert(removeStringEnd("12c", ends) == "12"); + assert(removeStringEnd("foo", ends) == ""); } }; |