assertEquals("ș'aibă", FlexStringUtil::placeAccent("șaibă", 2, 'a')); assertEquals("ș'aibă", FlexStringUtil::placeAccent("șaibă", 3, 'a')); assertEquals("șa'ibă", FlexStringUtil::placeAccent("șaibă", 2, 'i')); assertEquals("șa'ibă", FlexStringUtil::placeAccent("șaibă", 3, 'i')); assertEquals("unfuckingbelievable", FlexStringUtil::insert("unbelievable", "f*****g", 2)); assertEquals("abcdef", FlexStringUtil::insert("cdef", "ab", 0)); assertEquals("abcdef", FlexStringUtil::insert("abcd", "ef", 4)); assertEquals('mamă ', AdminStringUtil::padRight('mamă', 10)); assertEquals('mama ', AdminStringUtil::padRight('mama', 10)); assertEquals('ăâîșț ', AdminStringUtil::padRight('ăâîșț', 8)); assertEquals('ăâîșț', AdminStringUtil::padRight('ăâîșț', 5)); assertEquals('ăâîșț', AdminStringUtil::padRight('ăâîșț', 3)); assertEqualArrays(array('c', 'a', 'r'), AdminStringUtil::unicodeExplode('car')); assertEqualArrays(array('ă', 'a', 'â', 'ș', 'ț'), AdminStringUtil::unicodeExplode('ăaâșț')); assertEqualArrays(array(1, 5, 10), util_intersectArrays(array(1, 3, 5, 7, 9, 10), array(1, 2, 4, 5, 6, 8, 10))); assertEqualArrays(array(), util_intersectArrays(array(2, 4, 6, 8), array(1, 3, 5, 7))); assert(!Lock::release('test')); assert(!Lock::exists('test')); assert(Lock::acquire('test')); assert(Lock::exists('test')); assert(!Lock::acquire('test')); assert(Lock::release('test')); assert(!Lock::exists('test')); assert(!Lock::release('test')); assertEquals(0, util_findSnippet(array(array(1, 2, 10)))); assertEquals(1, util_findSnippet(array(array(1, 2, 10), array(5, 6, 9)))); assertEquals(2, util_findSnippet(array(array(1, 2, 10), array(5, 6, 8)))); assertEquals(4, util_findSnippet(array(array(1, 2, 10), array(6, 20), array(8, 15)))); assertEquals('$abc$ @def@', AdminStringUtil::formatLexem('$abc$ @def@')); // This is intentional -- lexem formatting is very lenient. assertEquals("m'amă m'are", AdminStringUtil::formatLexem("m'am~a máre "));
function runTestSuite() { assertEqualArrays(array("mama"), normalizeForm("mama")); assertEqualArrays(array("m'ama", "t'ata"), normalizeForm(" m'ama ( t'ata ) ")); assertEqualArrays(array("a", "b", "c", "d", "e"), normalizeForm("a/b/c (d / e)")); assertEqualArrays(array("starostilor", "staroștilor"), normalizeForm("staro-s/ș-tilor")); assertEqualArrays(array("abcde", "acde", "abce", "ace"), normalizeForm("a[b]c[d]e")); assertEqualArrays(array("abef", "abgh", "cdef", "cdgh"), normalizeForm("ab-, cd- | -ef, -gh")); }