From 62727012d37ef3d3cacc413d5667dc2d7bbf9cbb Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 12 May 2012 01:55:18 -0700 Subject: language detection library --- .../tests/Text_LanguageDetect_ISO639Test.php | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 library/langdet/tests/Text_LanguageDetect_ISO639Test.php (limited to 'library/langdet/tests/Text_LanguageDetect_ISO639Test.php') diff --git a/library/langdet/tests/Text_LanguageDetect_ISO639Test.php b/library/langdet/tests/Text_LanguageDetect_ISO639Test.php new file mode 100644 index 000000000..e01d715e1 --- /dev/null +++ b/library/langdet/tests/Text_LanguageDetect_ISO639Test.php @@ -0,0 +1,72 @@ +assertEquals( + 'de', + Text_LanguageDetect_ISO639::nameToCode2('german') + ); + } + + public function testNameToCode2Fail() + { + $this->assertNull( + Text_LanguageDetect_ISO639::nameToCode2('doesnotexist') + ); + } + + public function testNameToCode3() + { + $this->assertEquals( + 'fra', + Text_LanguageDetect_ISO639::nameToCode3('french') + ); + } + + public function testNameToCode3Fail() + { + $this->assertNull( + Text_LanguageDetect_ISO639::nameToCode3('doesnotexist') + ); + } + + public function testCode2ToName() + { + $this->assertEquals( + 'english', + Text_LanguageDetect_ISO639::code2ToName('en') + ); + } + + public function testCode2ToNameFail() + { + $this->assertNull( + Text_LanguageDetect_ISO639::code2ToName('nx') + ); + } + + public function testCode3ToName() + { + $this->assertEquals( + 'romanian', + Text_LanguageDetect_ISO639::code3ToName('rom') + ); + } + + public function testCode3ToNameFail() + { + $this->assertNull( + Text_LanguageDetect_ISO639::code3ToName('nxx') + ); + } + +} + +?> \ No newline at end of file -- cgit v1.2.3