diff options
-rw-r--r-- | test/common/util.h | 16 |
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); + } + } + } }; |