MDL-19270 core_text: added unit tests for strrev

This commit is contained in:
Sam Hemelryk 2014-07-08 14:14:51 +12:00
parent d320391099
commit 1c194014bf

View File

@ -249,6 +249,26 @@ class core_text_testcase extends advanced_testcase {
$this->assertSame($str, core_text::strtoupper($str, 'GB18030'));
}
/**
* Test the strrev method.
*/
public function test_strrev() {
$strings = array(
"Žluťoučký koníček" => "kečínok ýkčuoťulŽ",
'ŽLUŤOUČKÝ KONÍČEK' => "KEČÍNOK ÝKČUOŤULŽ",
'言語設定' => '定設語言',
'简体中文' => '文中体简',
"Der eine stößt den Speer zum Mann" => "nnaM muz reepS ned tßöts enie reD"
);
foreach ($strings as $before => $after) {
// Make sure we can reverse it both ways and that it comes out the same.
$this->assertSame($after, core_text::strrev($before));
$this->assertSame($before, core_text::strrev($after));
// Reverse it twice to be doubly sure.
$this->assertSame($after, core_text::strrev(core_text::strrev($after)));
}
}
/**
* Tests the static strpos method.
*/