| 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 |
} |