Module:typing-aids/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search

2 of 306 tests failed. (refresh)

TextExpectedActual
test_Akkadian:
Passedša𒊭𒊭
TextExpectedActual
test_Arabic:
Passedal-Huruuf al-qamariyyat'الْحُرُوف الْقَمَرِيَّةالْحُرُوف الْقَمَرِيَّة
Passedal-Huruuf al-xamsiyyat'الْحُرُوف الشَّمْسِيَّةالْحُرُوف الشَّمْسِيَّة
Passedealifu WlwaSliأَلِفُ ٱلْوَصْلِأَلِفُ ٱلْوَصْلِ
Passedmaaeمَاءمَاء
Passedmueminمُؤْمِنمُؤْمِن
PassedeiDaafat'إِضَافَةإِضَافَة
Passedeaabآبآب
Passedqureaanقُرْآنقُرْآن
PassedqiTTat'قِطَّةقِطَّة
PassedfaEEaalفَعَّالفَعَّال
Passedxayeuشَيْءُشَيْءُ
PassedxayeaNشَيْءًشَيْءً
PasseddaaeimaNدَائِمًادَائِمًا
Passedmabduueat'مَبْدُوءَةمَبْدُوءَة
Passedmabduu'at'مَبْدُوءَةمَبْدُوءَة
PassedbadaaeiyyuNبَدَائِيٌّبَدَائِيٌّ
Passedbadaaeat'بَدَاءَةبَدَاءَة
Passedmaktuubمَكْتُوبمَكْتُوب
PassedtaHriirتَحْرِيرتَحْرِير
PassedEuZmaaaعُظْمَىعُظْمَى
Passedean0أَنْأَنْ
Passedlaw0لَوْلَوْ
Passedxay'aNشَيْءًشَيْءً
Passedta7riirتَحْرِيرتَحْرِير
Passed3axarat'عَشَرَةعَشَرَة
TextExpectedActual
test_Armenian:
Passedazgaynac`umազգայնացումազգայնացում
Failedazgaynacʿumազգայնացումազգայնածʿում
Passedterewտերևտերև
Passedburz^uaziaբուրժուազիաբուրժուազիա
Passedburžuaziaբուրժուազիաբուրժուազիա
Passedkol_mnakiկողմնակիկողմնակի
Passedkołmnakiկողմնակիկողմնակի
TextExpectedActual
test_Armenian_tr:
Failedazgaynac`umazgaynacʿumazgaynacʻum
Passedterewterewterew
Passedburz^uaziaburžuaziaburžuazia
Passedkol_mnakikołmnakikołmnaki
TextExpectedActual
test_Avestan:
Passedap𐬀𐬞𐬀𐬞
Passedxs.^uuas^𐬑𐬴𐬎𐬎𐬀𐬱𐬑𐬴𐬎𐬎𐬀𐬱
Passedxṣ̌uuaš𐬑𐬴𐬎𐬎𐬀𐬱𐬑𐬴𐬎𐬎𐬀𐬱
Passedv@hrka_na𐬬𐬆𐬵𐬭𐬐𐬁𐬥𐬀𐬬𐬆𐬵𐬭𐬐𐬁𐬥𐬀
Passedvəhrkāna𐬬𐬆𐬵𐬭𐬐𐬁𐬥𐬀𐬬𐬆𐬵𐬭𐬐𐬁𐬥𐬀
Passednae_za𐬥𐬀𐬉𐬰𐬀𐬥𐬀𐬉𐬰𐬀
Passednaēza𐬥𐬀𐬉𐬰𐬀𐬥𐬀𐬉𐬰𐬀
PassedzaaO𐬰𐬃𐬰𐬃
Passedzā̊𐬰𐬃𐬰𐬃
PassedhizwaO𐬵𐬌𐬰𐬎𐬎𐬂𐬵𐬌𐬰𐬎𐬎𐬂
Passedhizuuå𐬵𐬌𐬰𐬎𐬎𐬂𐬵𐬌𐬰𐬎𐬎𐬂
TextExpectedActual
test_Avestan_tr:
Passedapapap
Passedxs.^uuas^xṣ̌uuašxṣ̌uuaš
Passedv@hrka_navəhrkānavəhrkāna
Passednae_zanaēzanaēza
PassedzaaOzā̊zā̊
PassedhizwaOhizuuåhizuuå
TextExpectedActual
test_Germanic:
Passed*t'a_ko^`*þākǫ̂*þākǫ̂
Passed*T'eudo_balt'az*Þeudōbalþaz*Þeudōbalþaz
Passed*bo_kijo_`*bōkijǭ*bōkijǭ
TextExpectedActual
test_Gothic:
Passedƕaiwa𐍈𐌰𐌹𐍅𐌰𐍈𐌰𐌹𐍅𐌰
Passedanþar𐌰𐌽𐌸𐌰𐍂𐌰𐌽𐌸𐌰𐍂
Passedfidwōr𐍆𐌹𐌳𐍅𐍉𐍂𐍆𐌹𐌳𐍅𐍉𐍂
Passedfidwor𐍆𐌹𐌳𐍅𐍉𐍂𐍆𐌹𐌳𐍅𐍉𐍂
Passedmikils𐌼𐌹𐌺𐌹𐌻𐍃𐌼𐌹𐌺𐌹𐌻𐍃
Passedhēr𐌷𐌴𐍂𐌷𐌴𐍂
Passedher𐌷𐌴𐍂𐌷𐌴𐍂
Passedvac𐍈𐌰𐌸𐍈𐌰𐌸
TextExpectedActual
test_Greek:
Passeda__iᾱͅᾱͅ
Passeda)lhqh/sἀληθήςἀληθής
Passeda)lhqhs*ἀληθησἀληθησ
Passeda)lhqhs-ἀληθησ-ἀληθησ-
Passeda^)nh/rᾰ̓νήρᾰ̓νήρ
PassedPhlhi+a/dhsΠηληϊάδηςΠηληϊάδης
PassedPhlhi^+a^/dhsΠηληῐ̈ᾰ́δηςΠηληῐ̈ᾰ́δης
PassedΠηληϊ^ά^δηςΠηληῐ̈ᾰ́δηςΠηληῐ̈ᾰ́δης
Passede)a_/nἐᾱ́νἐᾱ́ν
Passedἐά_νἐᾱ́νἐᾱ́ν
Passedpa=sa^πᾶσᾰπᾶσᾰ
Passedu_(mei=sῡ̔μεῖςῡ̔μεῖς
Passeda/)^nerᾰ̓́νερᾰ̓́νερ
Passeda/^)nerᾰ̓́νερᾰ̓́νερ
Passeda)/^nerᾰ̓́νερᾰ̓́νερ
Passeda)^/nerᾰ̓́νερᾰ̓́νερ
Passeddai+/frwnδαΐφρωνδαΐφρων
Passeddai/+frwnδαΐφρωνδαΐφρων
TextExpectedActual
test_Hellenic:
Passed*tat^t^o_*taťťō*taťťō
Passed*d^o_'yyon*ďṓyyon*ďṓyyon
Passed*gw@n'n'o_*gʷəňňō*gʷəňňō
Passed*gw@n^n^o_*gʷəňňō*gʷəňňō
Passed*kwhe_r*kʷʰēr*kʷʰēr
Passed*khwe_r*kʷʰēr*kʷʰēr
TextExpectedActual
test_Hittite:
Passeda-ku𒀀𒆪𒀀𒆪
Passedan-tu-wa-ah-ha-as𒀭𒌅𒉿𒄴𒄩𒀸𒀭𒌅𒉿𒄴𒄩𒀸
Passedan-tu-wa-aḫ-ḫa-aš𒀭𒌅𒉿𒄴𒄩𒀸𒀭𒌅𒉿𒄴𒄩𒀸
PassedDINGIRIŠKUR𒀭𒅎𒀭𒅎
TextExpectedActual
test_Imperial_Aramaic:
Passed'nḥn𐡀𐡍𐡇𐡍𐡀𐡍𐡇𐡍
TextExpectedActual
test_Japanese:
Passediro ha nihohetoいろ は にほへといろ は にほへと
Passeduwyi no okuyamaうゐ の おくやまうゐ の おくやま
PassedFAMIRI-MA-TOファミリーマートファミリーマート
Passedaltuあっあっ
Passedhi/mi/tuひ・み・つひ・み・つ
Passedhan'iはんいはんい
Passedhanniはんいはんい
Passedkonnyouこんようこんよう
Passedmannnakaまんなかまんなか
Passedattiikeあっちいけあっちいけ
Passedacchiikeあっちいけあっちいけ
Passedupnusiうpぬしうpぬし
TextExpectedActual
test_Kaithi:
PassedhanU𑂯𑂢𑂴𑂯𑂢𑂴
Passedpa_rh_ahi𑂣𑂜𑂯𑂱𑂣𑂜𑂯𑂱
Passedsiya~𑂮𑂱𑂨𑂀𑂮𑂱𑂨𑂀
Passedjhara-i𑂕𑂩𑂅𑂕𑂩𑂅
Passedjharaï𑂕𑂩𑂅𑂕𑂩𑂅
PassedAgi𑂄𑂏𑂱𑂄𑂏𑂱
Passedāgi𑂄𑂏𑂱𑂄𑂏𑂱
TextExpectedActual
test_Kannada:
PassedyaMtraಯಂತ್ರಯಂತ್ರ
Passedsadāśivaಸದಾಶಿವಸದಾಶಿವ
Passedmuṣṭiಮುಷ್ಟಿಮುಷ್ಟಿ
Passeddhairyaಧೈರ್ಯಧೈರ್ಯ
PassedELuಏಳುಏಳು
PassediMguzETiyAಇಂಗುಶೇಟಿಯಾಇಂಗುಶೇಟಿಯಾ
PassedupayOgaಉಪಯೋಗಉಪಯೋಗ
TextExpectedActual
test_Maithili:
PassedmaithilI𑒧𑒻𑒟𑒱𑒪𑒲𑒧𑒻𑒟𑒱𑒪𑒲
PassedghO_r_A𑒒𑒼𑒛𑓃𑒰𑒒𑒼𑒛𑓃𑒰
Passedga_rh_a𑒑𑒜𑓃𑒑𑒜𑓃
PassedmokAma𑒧𑒽𑒏𑒰𑒧𑒧𑒽𑒏𑒰𑒧
Passedpa~cakhaNDI𑒣𑒿𑒔𑒐𑒝𑓂𑒛𑒲𑒣𑒿𑒔𑒐𑒝𑓂𑒛𑒲
Passedheraba𑒯𑒺𑒩𑒥𑒯𑒺𑒩𑒥
TextExpectedActual
test_Marwari:
PassedmahAjanI𑅬𑅱𑅛𑅧𑅑𑅬𑅱𑅛𑅧𑅑
PassedmukAMm𑅬𑅒𑅕𑅧𑅬𑅬𑅒𑅕𑅧𑅬
PassedAvalA𑅐𑅯𑅮𑅐𑅯𑅮
PassedAgarA𑅐𑅗𑅭𑅐𑅗𑅭
Passedupama𑅒𑅨𑅬𑅒𑅨𑅬
PassediMdaura𑅑𑅧𑅥𑅒𑅭𑅑𑅧𑅥𑅒𑅭
TextExpectedActual
test_Old_Church_Slavonic:
Passedljudijeлюдиѥлюдиѥ
Passedazuhазъазъ
Passedbukyбоукꙑбоукꙑ
Passedmŭčatiмъчатимъчати
PassedIosijaИосиꙗИосиꙗ
TextExpectedActual
test_Old_Marathi:
PassedkuhA𑘎𑘳𑘮𑘰𑘎𑘳𑘮𑘰
Passedkuhā𑘎𑘳𑘮𑘰𑘎𑘳𑘮𑘰
Passednibara𑘡𑘲𑘤𑘨𑘡𑘲𑘤𑘨
PassednIbara𑘡𑘲𑘤𑘨𑘡𑘲𑘤𑘨
Passednībara𑘡𑘲𑘤𑘨𑘡𑘲𑘤𑘨
PassedAi𑘁𑘃𑘁𑘃
Passedāi𑘁𑘃𑘁𑘃
PassedAI𑘁𑘃𑘁𑘃
Passedāī𑘁𑘃𑘁𑘃
Passedsuta𑘭𑘳𑘝𑘭𑘳𑘝
PassedsUta𑘭𑘳𑘝𑘭𑘳𑘝
Passedsuta𑘭𑘳𑘝𑘭𑘳𑘝
Passeduta𑘄𑘝𑘄𑘝
PassedUta𑘄𑘝𑘄𑘝
Passeduta𑘄𑘝𑘄𑘝
Passedna-i𑘡𑘃𑘡𑘃
Passednaï𑘡𑘃𑘡𑘃
Passeda-ila𑘀𑘃𑘩𑘀𑘃𑘩
Passedaïla𑘀𑘃𑘩𑘀𑘃𑘩
Passedbhavai𑘥𑘪𑘺𑘥𑘪𑘺
Passedcauka𑘓𑘼𑘎𑘓𑘼𑘎
Passedca-utha𑘓𑘄𑘞𑘓𑘄𑘞
Passedcaütha𑘓𑘄𑘞𑘓𑘄𑘞
Passeda-ukSa𑘀𑘄𑘎𑘿𑘬𑘀𑘄𑘎𑘿𑘬
Passeda-ukṣa𑘀𑘄𑘎𑘿𑘬𑘀𑘄𑘎𑘿𑘬
PassedaükSa𑘀𑘄𑘎𑘿𑘬𑘀𑘄𑘎𑘿𑘬
Passedaükṣa𑘀𑘄𑘎𑘿𑘬𑘀𑘄𑘎𑘿𑘬
PassedAThoLI𑘁𑘙𑘻𑘯𑘲𑘁𑘙𑘻𑘯𑘲
Passedāṭhoḷī𑘁𑘙𑘻𑘯𑘲𑘁𑘙𑘻𑘯𑘲
PassedraMbhA𑘨𑘽𑘥𑘰𑘨𑘽𑘥𑘰
Passedraṃbhā𑘨𑘽𑘥𑘰𑘨𑘽𑘥𑘰
PassedhRdA𑘮𑘵𑘟𑘰𑘮𑘵𑘟𑘰
Passedhṛdā𑘮𑘵𑘟𑘰𑘮𑘵𑘟𑘰
PassedRkha𑘆𑘏𑘆𑘏
Passedṛkha𑘆𑘏𑘆𑘏
PassedSaDa𑘬𑘚𑘬𑘚
Passedṣaḍa𑘬𑘚𑘬𑘚
PassedkSeNa𑘎𑘿𑘬𑘹𑘜𑘎𑘿𑘬𑘹𑘜
Passedkṣeṇa𑘎𑘿𑘬𑘹𑘜𑘎𑘿𑘬𑘹𑘜
PassedzobhaNe𑘫𑘻𑘥𑘜𑘹𑘫𑘻𑘥𑘜𑘹
Passedśobhaṇe𑘫𑘻𑘥𑘜𑘹𑘫𑘻𑘥𑘜𑘹
Passedarha𑘀𑘨𑘿𑘮𑘀𑘨𑘿𑘮
Passedmar_hATI𑘦𑘨𑘿‍𑘮𑘰𑘘𑘲𑘦𑘨𑘿‍𑘮𑘰𑘘𑘲
Passedmaṟhāṭī𑘦𑘨𑘿‍𑘮𑘰𑘘𑘲𑘦𑘨𑘿‍𑘮𑘰𑘘𑘲
TextExpectedActual
test_Old_Marathi_tr:
PassedkuhAkuhākuhā
Passednibaranibaranibara
PassednIbaranībaranībara
PassedAiāiāi
PassedAIāīāī
Passedsutasutasuta
PassedsUtasutasuta
Passedutautauta
PassedUtautauta
Passedna-ina-ina-i
Passednaïnaïnaï
Passeda-ilaa-ilaa-ila
Passedaïlaaïlaaïla
Passedbhavaibhavaibhavai
Passedcaukacaukacauka
Passedca-uthaca-uthaca-utha
Passedcaüthacaüthacaütha
Passeda-ukSaa-ukṣaa-ukṣa
PassedaükSaaükṣaaükṣa
PassedAThoLIāṭhoḷīāṭhoḷī
PassedraMbhAraṃbhāraṃbhā
PassedhRdAhṛdāhṛdā
PassedRkhaṛkhaṛkha
PassedSaDaṣaḍaṣaḍa
PassedkSeNakṣeṇakṣeṇa
PassedzobhaNeśobhaṇeśobhaṇe
Passedarhaarhaarha
Passedmar_hATImaṟhāṭīmaṟhāṭī
TextExpectedActual
test_Old_Persian:
Passedaitiiy𐎠𐎡𐎫𐎡𐎹𐎠𐎡𐎫𐎡𐎹
Passedraucah𐎼𐎢𐎨𐏃𐎼𐎢𐎨𐏃
Passedham𐏃𐎶𐏃𐎶
Passedjiva𐎪𐎺𐎪𐎺
Passeddaraniyakara𐎭𐎼𐎴𐎹𐎣𐎼𐎭𐎼𐎴𐎹𐎣𐎼
Passeddaragama𐎭𐎼𐎥𐎶𐎭𐎼𐎥𐎶
TextExpectedActual
test_Old_South_Arabian:
Passeds²ms¹𐩦𐩣𐩪𐩦𐩣𐩪
TextExpectedActual
test_Ossetian:
Passedfynʒфындзфындз
Passedæxsævӕхсӕвӕхсӕв
Passedc’æxцъӕхцъӕх
Passedbiræǧбирӕгъбирӕгъ
PassedRæstʒinadРӕстдзинадРӕстдзинад
TextExpectedActual
test_PIE:
Passed*dye_'ws*dyḗws*dyḗws
Passed*n0mr0to's*n̥mr̥tós*n̥mr̥tós
Passed*tk'e'yti*tḱéyti*tḱéyti
Passed*h1es-*h₁es-*h₁es-
Passed*t_ep-e'h1(ye)-ti*tₔp-éh₁(ye)-ti*tₔp-éh₁(ye)-ti
Passed*h1e'k'wos*h₁éḱwos*h₁éḱwos
Passed*bhebho'ydhe*bʰebʰóydʰe*bʰebʰóydʰe
Passed*dh3to's*dh₃tós*dh₃tós
Passed*dhewg'h-*dʰewǵʰ-*dʰewǵʰ-
TextExpectedActual
test_Parthian:
Passedtšynd𐫤𐫢𐫏𐫗𐫅𐫤𐫢𐫏𐫗𐫅
Passedxʾrtʾg𐫟𐫀𐫡𐫤𐫀𐫃𐫟𐫀𐫡𐫤𐫀𐫃
Passedhʾmhyrz𐫍𐫀𐫖𐫍𐫏𐫡𐫉𐫍𐫀𐫖𐫍𐫏𐫡𐫉
Passedʿšnwhr𐫙𐫢𐫗𐫇𐫍𐫡𐫙𐫢𐫗𐫇𐫍𐫡
Passedhʾwsʾr𐫍𐫀𐫇𐫘𐫀𐫡𐫍𐫀𐫇𐫘𐫀𐫡
TextExpectedActual
test_Persian:
PassedbrAdrبرادربرادر
TextExpectedActual
test_Sanskrit:
PassedsaMskRta/संस्कृतसंस्कृत
Passedsaṃskṛtáसंस्कृतसंस्कृत
PassedkSatri/yaक्षत्रियक्षत्रिय
Passedkṣatríyaक्षत्रियक्षत्रिय
PassedrAja suprabuddhaराज सुप्रबुद्धराज सुप्रबुद्ध
Passedrāja suprabuddhaराज सुप्रबुद्धराज सुप्रबुद्ध
PassedzAkyamuniशाक्यमुनिशाक्यमुनि
Passedśākyamuniशाक्यमुनिशाक्यमुनि
PassedsiMhaसिंहसिंह
Passedsiṃhaसिंहसिंह
PassednAmanनामन्नामन्
Passednāmanनामन्नामन्
PassedanA/अनाअना
Passedanā́अनाअना
PassedayuSmAnअयुष्मान्अयुष्मान्
Passedayuṣmānअयुष्मान्अयुष्मान्
Passedghatsyatiघत्स्यतिघत्स्यति
PassedtApa-iतापइतापइ
Passedtāpa-iतापइतापइ
PassedtApaïतापइतापइ
Passedtāpaïतापइतापइ
TextExpectedActual
test_Sanskrit_tr:
PassedsaMskRta/saṃskṛtásaṃskṛtá
PassedkSatri/yakṣatríyakṣatríya
PassedrAja suprabuddharāja suprabuddharāja suprabuddha
PassedzAkyamuniśākyamuniśākyamuni
PassedsiMhasiṃhasiṃha
PassednAmannāmannāman
PassedanA/anā́anā́
PassedayuSmAnayuṣmānayuṣmān
Passedghatsyatighatsyatighatsyati
PassedtApa-itāpa-itāpa-i
PassedtApaïtāpaïtāpaï
TextExpectedActual
test_Saurashtra:
Passedpaniꢦꢥꢶꢦꢥꢶ
PassedvAgꢮꢵꢔ꣄ꢮꢵꢔ꣄
PassedghoDoꢕꣁꢞꣁꢕꣁꢞꣁ
Passeddukkarꢣꢸꢒ꣄ꢒꢬ꣄ꢣꢸꢒ꣄ꢒꢬ꣄
Passedl:ovoꢭꢴꣁꢮꣁꢭꢴꣁꢮꣁ
TextExpectedActual
test_Siddham:
Passedkanta𑖎𑖡𑖿𑖝𑖎𑖡𑖿𑖝
PassedpurAna𑖢𑖲𑖨𑖯𑖡𑖢𑖲𑖨𑖯𑖡
PassedNa-i𑖜𑖂𑖜𑖂
PassedkaNNa𑖎𑖜𑖿𑖜𑖎𑖜𑖿𑖜
PassedsamAia𑖭𑖦𑖯𑖂𑖀𑖭𑖦𑖯𑖂𑖀
Passedtujjhu𑖝𑖲𑖕𑖿𑖖𑖲𑖝𑖲𑖕𑖿𑖖𑖲
Passedkahante𑖎𑖮𑖡𑖿𑖝𑖸𑖎𑖮𑖡𑖿𑖝𑖸
TextExpectedActual
test_Sindhi:
PassedsiMdhī𑋝𑋡𑋟𑋐𑋢𑋝𑋡𑋟𑋐𑋢
PassedbhAGo𑋖𑋠𑊿𑋧𑋖𑋠𑊿𑋧
PassedmAlu𑋗𑋠𑋚𑋣𑋗𑋠𑋚𑋣
Passedjeko𑋂𑋥𑊺𑋧𑋂𑋥𑊺𑋧
Passedxabara𑊻𑋩𑋔𑋙𑊻𑋩𑋔𑋙
PassedmuqAmu𑋗𑋣𑊺𑋩𑋠𑋗𑋣𑋗𑋣𑊺𑋩𑋠𑋗𑋣
PassedmeM𑋗𑋥𑋟𑋗𑋥𑋟
PassedgunAhu𑊼𑋣𑋑𑋠𑋞𑋣𑊼𑋣𑋑𑋠𑋞𑋣
Passed_gh_araza𑊼𑋩𑋙𑋂𑋩𑊼𑋩𑋙𑋂𑋩
Passed_gh_ufA𑊼𑋩𑋣𑋓𑋩𑋠𑊼𑋩𑋣𑋓𑋩𑋠
PassedbA_gh_u𑋔𑋠𑊼𑋩𑋣𑋔𑋠𑊼𑋩𑋣
Passedba_gh_adAdu𑋔𑊼𑋩𑋏𑋠𑋏𑋣𑋔𑊼𑋩𑋏𑋠𑋏𑋣
PassedghaTaNu𑊾𑋆𑋌𑋣𑊾𑋆𑋌𑋣
TextExpectedActual
test_all:
Passed*dye_'ws*dyḗws*dyḗws
Passed*n0mr0to's*n̥mr̥tós*n̥mr̥tós
Passed*tk'e'yti*tḱéyti*tḱéyti
Passed*h1es-*h₁es-*h₁es-
Passed*t_ep-e'h1(ye)-ti*tₔp-éh₁(ye)-ti*tₔp-éh₁(ye)-ti
Passed*h1e'k'wos*h₁éḱwos*h₁éḱwos
Passed*bhebho'ydhe*bʰebʰóydʰe*bʰebʰóydʰe
Passed*dh3to's*dh₃tós*dh₃tós
Passed*t'a_ko^`*þākǫ̂*þākǫ̂
Passed*T'eudo_balt'az*Þeudōbalþaz*Þeudōbalþaz
Passed*bo_kijo_`*bōkijǭ*bōkijǭ
Passed*tat^t^o_*taťťō*taťťō
Passed*d^o_'yyon*ďṓyyon*ďṓyyon

local tests = require('Module:UnitTests')
local m_typing = require('Module:typing-aids')
local get_by_code = require('Module:languages').getByCode

local decompose = mw.ustring.toNFD

local langs = {}
local tag_funcs = {}

-- Assumes one script per language.
local function tag_gen(test_text, langCode)
	local func = tag_funcs[langCode]
	if func then
		return func
	else
		if not langs[langCode] then
			langs[langCode] = get_by_code(langCode) or error('The language code ' .. langCode .. ' is invalid.')
		end
		
		local scCode = langs[langCode]:findBestScript(test_text):getCode() or
			error('No script could be found for the text ' .. test_text .. ' and the language code ' .. langCode .. '.')
		
		local before, after = '<span class="' .. scCode .. '" lang="' .. langCode .. '">', '</span>'
		function func(text)
			return before .. text .. after
		end
		tag_funcs[langCode] = func
		return func	
	end
end

local options_cache = {}
function tests:check_output(code, expected, lang, transliteration, sc)
	local result
	
	if lang then
		result = m_typing.replace{ lang, code, sc = sc }
	else
		result = m_typing.replace{code, sc = sc}
	end
	
	result = decompose(result)
	expected = decompose(expected)
	
	local options = options_cache[lang]
	if not options and lang and not transliteration then
		options = { display = tag_gen(result, lang) }
		options_cache[lang] = options
	end
	
	self:equals(
		code,
		result,
		expected,
		options
	)
end

function tests:do_tests(examples, lang, sc)
	local transliteration = lang ~= nil and lang:find("%-tr$") ~= nil
	for _, example in ipairs(examples) do
		if #example == 3 and not transliteration then
			self:check_output(example[1], example[3], lang, nil, sc)
			if example[2] ~= example[1] then
				self:check_output(example[2], example[3], lang, nil, sc)
			end
		else
			self:check_output(example[1], example[2], lang, transliteration, sc)
		end
	end
end

function tests:test_all()
	local examples = {
		{ "*dye_'ws", "*dyḗws" },
		{ "*n0mr0to's", "*n̥mr̥tós" },
		{ "*tk'e'yti", "*tḱéyti" },
		{ "*h1es-", "*h₁es-" },
		{ "*t_ep-e'h1(ye)-ti", "*tₔp-éh₁(ye)-ti" },
		{ "*h1e'k'wos", "*h₁éḱwos" },
		{ "*bhebho'ydhe", "*bʰebʰóydʰe" },
		{ "*dh3to's", "*dh₃tós" },
		{ "*t'a_ko^`", "*þākǫ̂" },
		{ "*T'eudo_balt'az", "*Þeudōbalþaz" },
		{ "*bo_kijo_`", "*bōkijǭ" },
		{ "*tat^t^o_", "*taťťō" },
		{ "*d^o_'yyon", "*ďṓyyon" },
	}
	
	self:do_tests(examples)
end

local ae_examples = {
	{ "ap", "ap", "𐬀𐬞" },
	{ "xs.^uuas^", "xṣ̌uuaš", "𐬑𐬴𐬎𐬎𐬀𐬱" },
	{ "v@hrka_na", "vəhrkāna", "𐬬𐬆𐬵𐬭𐬐𐬁𐬥𐬀" },
	{ "nae_za", "naēza", "𐬥𐬀𐬉𐬰𐬀" },
	{ "zaaO", "zā̊", "𐬰𐬃"},
	{ "hizwaO", "hizuuå", "𐬵𐬌𐬰𐬎𐬎𐬂"},
}

function tests:test_Avestan()
	self:do_tests(ae_examples, "ae")
end

function tests:test_Avestan_tr()
	self:do_tests(ae_examples, "ae-tr")
end

function tests:test_Akkadian()
	local examples = { 
		{ "ša", "𒊭" },
		-- { "transliteration", "result" },
	}
	self:do_tests(examples, "akk")
end

local hy_examples = {
	{ "azgaynac`um", "azgaynacʿum", "ազգայնացում" },
	{ "terew", "terew", "տերև" },
	{ "burz^uazia", "buržuazia", "բուրժուազիա" },
	{ "kol_mnaki", "kołmnaki", "կողմնակի" },
}

function tests:test_Armenian()
	self:do_tests(hy_examples, "hy")
end

function tests:test_Armenian_tr()
	self:do_tests(hy_examples, "hy-tr")
end

function tests:test_Arabic()
	local examples = {
		{ "al-Huruuf al-qamariyyat'", "الْحُرُوف الْقَمَرِيَّة" },
		{ "al-Huruuf al-xamsiyyat'", "الْحُرُوف الشَّمْسِيَّة" },
		{ "ealifu WlwaSli", "أَلِفُ ٱلْوَصْلِ" },
		{ "maae", "مَاء" },
		{ "muemin", "مُؤْمِن" },
		{ "eiDaafat'", "إِضَافَة" },
		{ "eaab", "آب" },
		{ "qureaan", "قُرْآن" },
		{ "qiTTat'", "قِطَّة" },
		{ "faEEaal", "فَعَّال" },
		{ "xayeu", "شَيْءُ" },
		{ "xayeaN", "شَيْءً" },
		{ "daaeimaN", "دَائِمًا" },
		{ "mabduueat'", "مَبْدُوءَة" },
		{ "mabduu'at'", "مَبْدُوءَة" },
		{ "badaaeiyyuN", "بَدَائِيٌّ" },
		{ "badaaeat'", "بَدَاءَة" },
		{ "maktuub", "مَكْتُوب" },
		{ "taHriir", "تَحْرِير" },
		{ "EuZmaaa", "عُظْمَى" },
		{ "ean0", "أَنْ" },
		{ "law0", "لَوْ" },
		{ "xay'aN", "شَيْءً" },
		{ "ta7riir", "تَحْرِير" },
		{ "3axarat'", "عَشَرَة" },
	}
	
	self:do_tests(examples, "ar")
end

function tests:test_Persian()
	local examples = {
		{ "brAdr", "برادر" },
	}
	
	self:do_tests(examples, "fa")
end

function tests:test_PIE()
	local examples = {
		{ "*dye_'ws", "*dyḗws" },
		{ "*n0mr0to's", "*n̥mr̥tós" },
		{ "*tk'e'yti", "*tḱéyti" },
		{ "*h1es-", "*h₁es-" },
		{ "*t_ep-e'h1(ye)-ti", "*tₔp-éh₁(ye)-ti" },
		{ "*h1e'k'wos", "*h₁éḱwos" },
		{ "*bhebho'ydhe", "*bʰebʰóydʰe" },
		{ "*dh3to's", "*dh₃tós" },
		{ "*dhewg'h-", "*dʰewǵʰ-" },
	}
	
	self:do_tests(examples, "ine-pro")
end

function tests:test_Germanic()
	local examples = {
		{ "*t'a_ko^`", "*þākǫ̂" },
		{ "*T'eudo_balt'az", "*Þeudōbalþaz" },
		{ "*bo_kijo_`", "*bōkijǭ" },
	}
	
	self:do_tests(examples, "gem-pro")
end

function tests:test_Gothic()
	local examples = {
		{ "ƕaiwa", "𐍈𐌰𐌹𐍅𐌰" },
		{ "anþar", "𐌰𐌽𐌸𐌰𐍂" },
		{ "fidwōr", "𐍆𐌹𐌳𐍅𐍉𐍂" },
		{ "fidwor", "𐍆𐌹𐌳𐍅𐍉𐍂" },
		{ "mikils", "𐌼𐌹𐌺𐌹𐌻𐍃" },
		{ "hēr", "𐌷𐌴𐍂" },
		{ "her", "𐌷𐌴𐍂" },
		{ "vac", "𐍈𐌰𐌸" },
--		{ "", "" },
	}
	
	self:do_tests(examples, "got")
end

function tests:test_Hellenic()
	local examples = {
		{ "*tat^t^o_", "*taťťō" },
		{ "*d^o_'yyon", "*ďṓyyon" },
		{ "*gw@n'n'o_", "*gʷəňňō" },
		{ "*gw@n^n^o_", "*gʷəňňō" },
		{ "*kwhe_r", "*kʷʰēr" },
		{ "*khwe_r", "*kʷʰēr" },
	}
	
	self:do_tests(examples, "grk-pro")
end

function tests:test_Greek()
	local examples = {
		{ "a__i", "ᾱͅ" },
		{ "a)lhqh/s", "ἀληθής" },
		{ "a)lhqhs*", "ἀληθησ" },
		{ "a)lhqhs-", "ἀληθησ-" },
		{ "a^)nh/r", "ᾰ̓νήρ" },
		{ "Phlhi+a/dhs", "Πηληϊάδης" },
		{ "Phlhi^+a^/dhs", "Πηληῐ̈ᾰ́δης" },
		{ "Πηληϊ^ά^δης", "Πηληῐ̈ᾰ́δης" },
		{ "e)a_/n", "ἐᾱ́ν" },
		{ "ἐά_ν", "ἐᾱ́ν" },
		{ "pa=sa^", "πᾶσᾰ" },
		{ "u_(mei=s", "ῡ̔μεῖς" },
		{ "a/)^ner", "ᾰ̓́νερ" },
		{ "a/^)ner", "ᾰ̓́νερ" },
		{ "a)/^ner", "ᾰ̓́νερ" },
		{ "a)^/ner", "ᾰ̓́νερ" },
		{ "dai+/frwn", "δαΐφρων" },
		{ "dai/+frwn", "δαΐφρων" },
	}
	
	self:do_tests(examples, "grc")
end

function tests:test_Hittite()
	local examples = {
		{ "a-ku", "𒀀𒆪" },
		{ "an-tu-wa-ah-ha-as", "𒀭𒌅𒉿𒄴𒄩𒀸" },
		{ "an-tu-wa-aḫ-ḫa-aš", "𒀭𒌅𒉿𒄴𒄩𒀸" },
		{ "<sup>DINGIR</sup>IŠKUR", "𒀭𒅎" }, -- Akkadian actually?
	}
	
	self:do_tests(examples, "hit")
end

function tests:test_Kannada()
	local examples = {
		{ "yaMtra", "ಯಂತ್ರ" },
		{ "sadāśiva", "ಸದಾಶಿವ" },
		{ "muṣṭi", "ಮುಷ್ಟಿ" },
		{ "dhairya", "ಧೈರ್ಯ" },
		{ "ELu", "ಏಳು" },
		{ "iMguzETiyA", "ಇಂಗುಶೇಟಿಯಾ" },
		{ "upayOga", "ಉಪಯೋಗ" },
	}
	
	self:do_tests(examples, "kn")
end

local sa_examples = {
	{ "saMskRta/", "saṃskṛtá", "संस्कृत" },
	{ "kSatri/ya", "kṣatríya", "क्षत्रिय" },
	{ "rAja suprabuddha", "rāja suprabuddha", "राज सुप्रबुद्ध"},
	{ "zAkyamuni", "śākyamuni", "शाक्यमुनि"},
	{ "siMha", "siṃha", "सिंह"},
	{ "nAman", "nāman", "नामन्"},
	{ "anA/", "anā́", "अना" },
	{ "ayuSmAn", "ayuṣmān", "अयुष्मान्"},
	{ "ghatsyati", "ghatsyati", "घत्स्यति"},
	{ "tApa-i", "tāpa-i", "तापइ" },
	{ "tApaï", "tāpaï", "तापइ" },
}

function tests:test_Sanskrit()
	self:do_tests(sa_examples, "sa")
end

function tests:test_Sanskrit_tr()
	self:do_tests(sa_examples, "sa-tr")
end

function tests:test_Maithili()
	local examples = {
		{ "maithilI", "𑒧𑒻𑒟𑒱𑒪𑒲" },
		{ "ghO_r_A", "𑒒𑒼𑒛𑓃𑒰" },
		{ "ga_rh_a", "𑒑𑒜𑓃" },
		{ "mokAma", "𑒧𑒽𑒏𑒰𑒧" },
		{ "pa~cakhaNDI", "𑒣𑒿𑒔𑒐𑒝𑓂𑒛𑒲" },
		{ "heraba", "𑒯𑒺𑒩𑒥" },
	}
	
	self:do_tests(examples, "mai")
end

function tests:test_Marwari()
	local examples = {
		{ "mahAjanI", "𑅬𑅱𑅛𑅧𑅑" },
		{ "mukAMm", "𑅬𑅒𑅕𑅧𑅬" },
		{ "AvalA", "𑅐𑅯𑅮" },
		{ "AgarA", "𑅐𑅗𑅭" },
		{ "upama", "𑅒𑅨𑅬" },
		{ "iMdaura", "𑅑𑅧𑅥𑅒𑅭" },
	}
	
	self:do_tests(examples, "mwr")
end

function tests:test_Old_Persian()
	local examples = {
		{ "aitiiy", "𐎠𐎡𐎫𐎡𐎹" },
		{ "raucah", "𐎼𐎢𐎨𐏃" },
		{ "ham", "𐏃𐎶" },
		{ "jiva", "𐎪𐎺"},
		{ "daraniyakara", "𐎭𐎼𐎴𐎹𐎣𐎼" },
		{ "daragama", "𐎭𐎼𐎥𐎶" },
	}

	self:do_tests(examples, "peo")
end

function tests:test_Parthian()
	local examples = {
		{ "tšynd", "𐫤𐫢𐫏𐫗𐫅" },
		{ "xʾrtʾg", "𐫟𐫀𐫡𐫤𐫀𐫃" },
		{ "hʾmhyrz", "𐫍𐫀𐫖𐫍𐫏𐫡𐫉" },
		{ "ʿšnwhr", "𐫙𐫢𐫗𐫇𐫍𐫡"},
		{ "hʾwsʾr", "𐫍𐫀𐫇𐫘𐫀𐫡" },
	}

	self:do_tests(examples, "xpr", "Mani")
end

function tests:test_Japanese()
	local examples = {
		{ "iro ha nihoheto", "いろ は にほへと" },
		{ "uwyi no okuyama", "うゐ の おくやま" },
		{ "FAMIRI-MA-TO", "ファミリーマート" },
		{ "altu", "あっ" },
		{ "hi/mi/tu", "ひ・み・つ" },
		{ "han'i", "はんい" },
		{ "hanni", "はんい" },
		{ "konnyou", "こんよう" },
		{ "mannnaka", "まんなか" },
		{ "attiike", "あっちいけ" },
		{ "acchiike", "あっちいけ" },
		{ "upnusi", "うpぬし" },
	}

	self:do_tests(examples, "ja")
end

function tests:test_Old_Church_Slavonic()
	local examples = {
		{ "ljudije", "людиѥ" },
		{ "azuh", "азъ" },
		{ "buky", "боукꙑ" },
		{ "mŭčati", "мъчати" },
		{ "Iosija", "Иосиꙗ" },
	}
	
	self:do_tests(examples, "cu")
end


local omr_examples = {
	{ "kuhA", "kuhā", "𑘎𑘳𑘮𑘰" },
	{ "nibara", "nibara", "𑘡𑘲𑘤𑘨" },
	{ "nIbara", "nībara", "𑘡𑘲𑘤𑘨" },
	{ "Ai", "āi", "𑘁𑘃" },
	{ "AI", "āī", "𑘁𑘃" },
	{ "suta", "suta", "𑘭𑘳𑘝" },
	{ "sUta", "suta", "𑘭𑘳𑘝" },
	{ "uta", "uta", "𑘄𑘝" },
	{ "Uta", "uta", "𑘄𑘝" },
	{ "na-i", "na-i", "𑘡𑘃" },
	{ "naï", "naï", "𑘡𑘃" },
	{ "a-ila", "a-ila", "𑘀𑘃𑘩" },
	{ "aïla", "aïla", "𑘀𑘃𑘩" },
	{ "bhavai", "bhavai", "𑘥𑘪𑘺" },
	{ "cauka", "cauka", "𑘓𑘼𑘎" },
	{ "ca-utha", "ca-utha", "𑘓𑘄𑘞" },
	{ "caütha", "caütha", "𑘓𑘄𑘞" },
	{ "a-ukSa", "a-ukṣa", "𑘀𑘄𑘎𑘿𑘬" },
	{ "aükSa", "aükṣa", "𑘀𑘄𑘎𑘿𑘬" },
	{ "AThoLI", "āṭhoḷī", "𑘁𑘙𑘻𑘯𑘲" },
	{ "raMbhA", "raṃbhā", "𑘨𑘽𑘥𑘰" },
	{ "hRdA", "hṛdā", "𑘮𑘵𑘟𑘰" },
	{ "Rkha", "ṛkha", "𑘆𑘏" },
	{ "SaDa", "ṣaḍa", "𑘬𑘚" },
	{ "kSeNa", "kṣeṇa", "𑘎𑘿𑘬𑘹𑘜" },
	{ "zobhaNe", "śobhaṇe", "𑘫𑘻𑘥𑘜𑘹" },
	{ "arha", "arha", "𑘀𑘨𑘿𑘮" },
	{ "mar_hATI", "maṟhāṭī", "𑘦𑘨𑘿‍𑘮𑘰𑘘𑘲" },
}

function tests:test_Old_Marathi()
	self:do_tests(omr_examples, "omr")
end

function tests:test_Old_Marathi_tr()
	self:do_tests(omr_examples, "omr-tr")
end

function tests:test_Ossetian()
	local examples = {
		{ "fynʒ", "фындз" },
		{ "æxsæv", "ӕхсӕв" },
		{ "c’æx", "цъӕх" },
		{ "biræǧ", "бирӕгъ" },
		{ "Ræstʒinad", "Рӕстдзинад" },
	}
	
	self:do_tests(examples, "os")
end

function tests:test_Imperial_Aramaic()
	local examples = {
		{ "'nḥn", "𐡀𐡍𐡇𐡍" },
	}
	
	self:do_tests(examples, "arc", "Armi")
end

function tests:test_Old_South_Arabian()
	local examples = {
		{ "s²ms¹", "𐩦𐩣𐩪" },
	}
	
	self:do_tests(examples, "xsa")
end

function tests:test_Siddham()
	local examples = {
		{ "kanta", "𑖎𑖡𑖿𑖝" },
		{ "purAna", "𑖢𑖲𑖨𑖯𑖡"},
		{ "Na-i", "𑖜𑖂"},
		{ "kaNNa", "𑖎𑖜𑖿𑖜"},
		{ "samAia", "𑖭𑖦𑖯𑖂𑖀"},
		{ "tujjhu", "𑖝𑖲𑖕𑖿𑖖𑖲"},
		{ "kahante", "𑖎𑖮𑖡𑖿𑖝𑖸"},
	}

	self:do_tests(examples, "inc-kam")
end

function tests:test_Kaithi()
	local examples = {
		{ "hanU", "𑂯𑂢𑂴" },
		{ "pa_rh_ahi", "𑂣𑂜𑂯𑂱" },
		{ "siya~", "𑂮𑂱𑂨𑂀" },
		{ "jhara-i", "𑂕𑂩𑂅" },
		{ "jharaï", "𑂕𑂩𑂅" },
		{ "Agi", "𑂄𑂏𑂱" },
		{ "āgi", "𑂄𑂏𑂱" },
	}
	
	self:do_tests(examples, "bho")
end

function tests:test_Saurashtra()
	local examples = {
		{ "pani", "ꢦꢥꢶ" },
		{ "vAg", "ꢮꢵꢔ꣄" },
		{ "ghoDo", "ꢕꣁꢞꣁ" },
		{ "dukkar", "ꢣꢸꢒ꣄ꢒꢬ꣄" },
		{ "l:ovo", "ꢭꢴꣁꢮꣁ" },
	}
	
	self:do_tests(examples, "saz")
end

function tests:test_Sindhi()
	local examples = {
		{ "siMdhī", "𑋝𑋡𑋟𑋐𑋢" },
		{ "bhAGo", "𑋖𑋠𑊿𑋧" },
		{ "mAlu", "𑋗𑋠𑋚𑋣" },
		{ "jeko", "𑋂𑋥𑊺𑋧" },
		{ "xabara", "𑊻𑋩𑋔𑋙" },
		{ "muqAmu", "𑋗𑋣𑊺𑋩𑋠𑋗𑋣" },
		{ "meM", "𑋗𑋥𑋟" },
		{ "gunAhu", "𑊼𑋣𑋑𑋠𑋞𑋣" },
		{ "_gh_araza", "𑊼𑋩𑋙𑋂𑋩" },
		{ "_gh_ufA", "𑊼𑋩𑋣𑋓𑋩𑋠" },
		{ "bA_gh_u", "𑋔𑋠𑊼𑋩𑋣" },
		{ "ba_gh_adAdu", "𑋔𑊼𑋩𑋏𑋠𑋏𑋣" },
		{ "ghaTaNu", "𑊾𑋆𑋌𑋣" },
	}
	
	self:do_tests(examples, "sd")
end


--[[
function tests:test_Old_North_Arabian()
	-- We need tests to verify that letters with diacritics or modifiers
	-- transliterate correctly.
	local examples = {
		{ "'lšdy", "𐪑𐪁𐪆𐪕𐪚" },
	}
	
	self:do_tests(examples, "sem-tha")
end
--]]

--[[
To add another example, place the following code
	within the braces of an "examples" table:
		{ "shortcut", "expected result" },
		{ "", "" },
or for Sanskrit,
	{ "Harvard-Kyoto", "IAST", "Devanagari" },
	{ "", "", "" },
]]

return tests