xref: /haiku/src/tests/kits/locale/LanguageTest.cpp (revision 529cd177b573aaba391c8adc9c9f5ad76a14bf81)
1 /*
2  * Copyright 2014 Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "LanguageTest.h"
8 
9 #include "Language.h"
10 
11 #include <cppunit/TestCaller.h>
12 #include <cppunit/TestSuite.h>
13 
14 
15 LanguageTest::LanguageTest()
16 {
17 }
18 
19 
20 LanguageTest::~LanguageTest()
21 {
22 }
23 
24 
25 void
26 LanguageTest::TestLanguage()
27 {
28 	BLanguage language("fr_FR");
29 	BString name;
30 	language.GetName(name);
31 	CPPUNIT_ASSERT_EQUAL(BString("français (France)"), name);
32 	CPPUNIT_ASSERT_EQUAL(BString("fr"), language.Code());
33 	CPPUNIT_ASSERT(language.Direction() == B_LEFT_TO_RIGHT);
34 }
35 
36 
37 /*static*/ void
38 LanguageTest::AddTests(BTestSuite& parent)
39 {
40 	CppUnit::TestSuite& suite = *new CppUnit::TestSuite("LanguageTest");
41 
42 	suite.addTest(new CppUnit::TestCaller<LanguageTest>(
43 		"LanguageTest::TestLanguage", &LanguageTest::TestLanguage));
44 
45 	parent.addTest("LanguageTest", &suite);
46 }
47