Develop and Download Open Source Software

Browse Subversion Repository

Contents of /jpinput/TestRomanCreator.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 336 - (show annotations) (download) (as text)
Sun Apr 6 21:40:53 2008 UTC (16 years ago) by satofumi
File MIME type: text/x-c++src
File size: 1798 byte(s)
convert string: char -> Uint16
1 /*!
2 \file
3 \brief RomanCreator ‚̃eƒXƒg
4
5 \author Satofumi KAMIMURA
6
7 $Id$
8 */
9
10 #include "TestRomanCreator.h"
11 #include "RomanCreator.h"
12
13 CPPUNIT_TEST_SUITE_REGISTRATION(TestRomanCreator);
14 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(TestRomanCreator, "TestRomanCreator");
15
16 using namespace beego;
17
18
19 void TestRomanCreator::convertTest(void) {
20
21 RomanCreator roman_creator;
22
23 // ‚  -> a
24 Uint16 converted[16] = { 0x3042, 0x0 };
25 std::vector<Uint16> input_example;
26 roman_creator.convert(input_example, converted);
27 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('a'), input_example[0]);
28 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('\0'), input_example[1]);
29
30 // ‚ ‚© -> aka
31 converted[0] = 0x3042;
32 converted[1] = 0x304b;
33 converted[2] = 0x0;
34 roman_creator.convert(input_example, converted);
35 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('a'), input_example[0]);
36 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('k'), input_example[1]);
37 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('a'), input_example[2]);
38 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('\0'), input_example[3]);
39
40 // ‚ª -> ga
41 converted[0] = 0x304c;
42 converted[1] = 0x0;
43 roman_creator.convert(input_example, converted);
44 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('g'), input_example[0]);
45 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('a'), input_example[1]);
46 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('\0'), input_example[2]);
47
48 // ‚ñ‚Î -> nba
49 converted[0] = 0x3093;
50 converted[1] = 0x3070;
51 converted[2] = 0x0;
52 roman_creator.convert(input_example, converted);
53 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('n'), input_example[0]);
54 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('b'), input_example[1]);
55 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('a'), input_example[2]);
56 CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('\0'), input_example[3]);
57 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26