From 64ee53a63a88de0eeb910cbd2c85d1ec2c0e26b1 Mon Sep 17 00:00:00 2001 From: belliash Date: Fri, 3 Aug 2018 08:00:39 +0200 Subject: [PATCH] Add first Aer test --- tests/unicode_characters.aer | 59 ++++++++++++++++++++++++++++++++++++ tests/unicode_characters.exp | 1 + 2 files changed, 60 insertions(+) create mode 100644 tests/unicode_characters.aer create mode 100644 tests/unicode_characters.exp diff --git a/tests/unicode_characters.aer b/tests/unicode_characters.aer new file mode 100644 index 0000000..bb81caa --- /dev/null +++ b/tests/unicode_characters.aer @@ -0,0 +1,59 @@ +class Unicode { + + public function unicon($str, $to_uni = true) { + $cp = array('А' => 'А', 'а' => 'а', + "Б" => "Б", "б" => "б", + "В" => "В", "в" => "в", + "Г" => "Г", "г" => "г", + "Д" => "Д", "д" => "д", + "Е" => "Е", "е" => "е", + "Ё" => "Ё", "ё" => "ё", + "Ж" => "Ж", "ж" => "ж", + "З" => "З", "з" => "з", + "И" => "И", "и" => "и", + "Й" => "Й", "й" => "й", + "К" => "К", "к" => "к", + "Л" => "Л", "л" => "л", + "М" => "М", "м" => "м", + "Н" => "Н", "н" => "н", + "О" => "О", "о" => "о", + "П" => "П", "п" => "п", + "Р" => "Р", "р" => "р", + "С" => "С", "с" => "с", + "Т" => "Т", "т" => "т", + "У" => "У", "у" => "у", + "Ф" => "Ф", "ф" => "ф", + "Х" => "Х", "х" => "х", + "Ц" => "Ц", "ц" => "ц", + "Ч" => "Ч", "ч" => "ч", + "Ш" => "Ш", "ш" => "ш", + "Щ" => "Щ", "щ" => "щ", + "Ъ" => "Ъ", "ъ" => "ъ", + "Ы" => "Ы", "ы" => "ы", + "Ь" => "Ь", "ь" => "ь", + "Э" => "Э", "э" => "э", + "Ю" => "Ю", "ю" => "ю", + "Я" => "Я", "я" => "я"); + if($to_uni) { + $str = strtr($str, $cp); + } else { + foreach($cp as $c) { + $cpp[$c] = array_search($c, $cp); + } + $str = strtr($str, $cpp); + } + return $str; + } + +} + +final class Main { + + public function __construct() { + $unicode = new Unicode(); + var_dump($unicode->unicon("ИфйжБЦ")); + } + +} + +new Main(); diff --git a/tests/unicode_characters.exp b/tests/unicode_characters.exp new file mode 100644 index 0000000..c57baab --- /dev/null +++ b/tests/unicode_characters.exp @@ -0,0 +1 @@ +string(42 'ИфйжБЦ')