TestRomanCreator.cpp

Go to the documentation of this file.
00001 
00010 #include "TestRomanCreator.h"
00011 #include "RomanCreator.h"
00012 
00013 CPPUNIT_TEST_SUITE_REGISTRATION(TestRomanCreator);
00014 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(TestRomanCreator, "TestRomanCreator");
00015 
00016 using namespace beego;
00017 
00018 
00019 void TestRomanCreator::convertTest(void) {
00020 
00021   RomanCreator roman_creator;
00022 
00023   // あ -> a
00024   Uint16 converted[16] = { 0x3042, 0x0 };
00025   std::vector<Uint16> input_example;
00026   roman_creator.convert(input_example, converted);
00027   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('a'), input_example[0]);
00028   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('\0'), input_example[1]);
00029 
00030   // あか -> aka
00031   converted[0] = 0x3042;
00032   converted[1] = 0x304b;
00033   converted[2] = 0x0;
00034   roman_creator.convert(input_example, converted);
00035   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('a'), input_example[0]);
00036   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('k'), input_example[1]);
00037   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('a'), input_example[2]);
00038   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('\0'), input_example[3]);
00039 
00040   // が -> ga
00041   converted[0] = 0x304c;
00042   converted[1] = 0x0;
00043   roman_creator.convert(input_example, converted);
00044   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('g'), input_example[0]);
00045   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('a'), input_example[1]);
00046   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('\0'), input_example[2]);
00047 
00048   // んば -> nba
00049   converted[0] = 0x3093;
00050   converted[1] = 0x3070;
00051   converted[2] = 0x0;
00052   roman_creator.convert(input_example, converted);
00053   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('n'), input_example[0]);
00054   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('b'), input_example[1]);
00055   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('a'), input_example[2]);
00056   CPPUNIT_ASSERT_EQUAL(static_cast<Uint16>('\0'), input_example[3]);
00057 }
00058 

Generated on Mon Apr 13 22:52:01 2009 by  doxygen 1.5.7.1