aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-04-02 12:55:22 +0200
committerFilippos Karapetis2019-04-06 15:02:58 +0300
commitbf5999044b8c87c014098f588517c2c946103623 (patch)
tree9f03ad156a3d9072ce06ba9268e6816d115505b0 /test
parentb070845a31410bae7b457201d63ec8b3b7c0e8e6 (diff)
downloadscummvm-rg350-bf5999044b8c87c014098f588517c2c946103623.tar.gz
scummvm-rg350-bf5999044b8c87c014098f588517c2c946103623.tar.bz2
scummvm-rg350-bf5999044b8c87c014098f588517c2c946103623.zip
COMMON: add test for Common::isPunct
Diffstat (limited to 'test')
-rw-r--r--test/common/util.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/common/util.h b/test/common/util.h
index e195f13a84..d109d5becb 100644
--- a/test/common/util.h
+++ b/test/common/util.h
@@ -234,4 +234,20 @@ class UtilTestSuite : public CxxTest::TestSuite {
}
}
}
+ void test_is_punct() {
+ // isPunct should return true if the input is a punctation ascii char.
+ for (int c = 0; c < 255; c++) {
+ if (c >= 33 && c <= 47) {
+ TS_ASSERT_EQUALS(Common::isPunct(c), 1);
+ } else if (c >= 58 && c <= 64) {
+ TS_ASSERT_EQUALS(Common::isPunct(c), 1);
+ } else if (c >= 91 && c <= 96) {
+ TS_ASSERT_EQUALS(Common::isPunct(c), 1);
+ } else if (c >= 123 && c <= 126) {
+ TS_ASSERT_EQUALS(Common::isPunct(c), 1);
+ } else {
+ TS_ASSERT_EQUALS(Common::isPunct(c), 0);
+ }
+ }
+ }
};