• R/O
  • SSH
  • HTTPS

qrobosdk: コミット


コミットメタ情報

リビジョン1782 (tree)
日時2010-04-17 12:31:41
作者satofumi

ログメッセージ

テストを実装

変更サマリ

差分

--- trunk/libs/input/convertJp.cpp (revision 1781)
+++ trunk/libs/input/convertJp.cpp (nonexistent)
@@ -1,21 +0,0 @@
1-/*!
2- \file
3- \brief 日本語への変換
4-
5- \author Satofumi KAMIMURA
6-
7- $Id$
8-*/
9-
10-#include "convertJp.h"
11-
12-using namespace qrk;
13-
14-
15-std::string qrk::convertJp(const char* raw_text)
16-{
17- (void)raw_text;
18- // !!!
19-
20- return "";
21-}
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
--- trunk/libs/input/convertJp.h (revision 1781)
+++ trunk/libs/input/convertJp.h (nonexistent)
@@ -1,21 +0,0 @@
1-#ifndef QRK_CONVERT_JP_H
2-#define QRK_CONVERT_JP_H
3-
4-/*!
5- \file
6- \brief 日本語への変換
7-
8- \author Satofumi KAMIMURA
9-
10- $Id$
11-*/
12-
13-#include <string>
14-
15-
16-namespace qrk
17-{
18- extern std::string convertJp(const char* raw_text);
19-}
20-
21-#endif /* !QRK_CONVERT_JP_H */
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
--- trunk/libs/input/TestConvertToRoman.cpp (nonexistent)
+++ trunk/libs/input/TestConvertToRoman.cpp (revision 1782)
@@ -0,0 +1,27 @@
1+/*!
2+ \file
3+ \brief convertToRoman.cpp のテスト
4+
5+ \author Satofumi KAMIMURA
6+
7+ $Id$
8+*/
9+
10+#include "TestConvertToRoman.h"
11+#include "convertToRoman.h"
12+
13+using namespace qrk;
14+using namespace std;
15+
16+CPPUNIT_TEST_SUITE_REGISTRATION(TestConvertToRoman);
17+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(TestConvertToRoman, "TestConvertToRoman");
18+
19+
20+void TestConvertToRoman::convertTest(void)
21+{
22+ // あ -> a
23+ CPPUNIT_ASSERT_EQUAL(string("a"), convertToRoman("あ"));
24+ CPPUNIT_ASSERT_EQUAL(string("aka"), convertToRoman("あか"));
25+ CPPUNIT_ASSERT_EQUAL(string("ga"), convertToRoman("が"));
26+ CPPUNIT_ASSERT_EQUAL(string("nba"), convertToRoman("んば"));
27+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/input/convertToRoman.cpp (nonexistent)
+++ trunk/libs/input/convertToRoman.cpp (revision 1782)
@@ -0,0 +1,19 @@
1+/*!
2+ \file
3+ \brief 日本語のローマ字文字列への変換
4+
5+ \author Satofumi KAMIMURA
6+
7+ $Id$
8+*/
9+
10+#include "convertToRoman.h"
11+
12+
13+std::string qrk::convertToRoman(const char* jp_text)
14+{
15+ (void)jp_text;
16+ // !!!
17+
18+ return "";
19+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/input/convertToJp.h (nonexistent)
+++ trunk/libs/input/convertToJp.h (revision 1782)
@@ -0,0 +1,21 @@
1+#ifndef QRK_CONVERT_TO_JP_H
2+#define QRK_CONVERT_TO_JP_H
3+
4+/*!
5+ \file
6+ \brief 日本語への変換
7+
8+ \author Satofumi KAMIMURA
9+
10+ $Id$
11+*/
12+
13+#include <string>
14+
15+
16+namespace qrk
17+{
18+ extern std::string convertToJp(const char* raw_text);
19+}
20+
21+#endif /* !QRK_CONVERT_TO_JP_H */
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/input/TestConvertToJp.h (nonexistent)
+++ trunk/libs/input/TestConvertToJp.h (revision 1782)
@@ -0,0 +1,29 @@
1+#ifndef TEST_CONVERT_TO_JP_H
2+#define TEST_CONVERT_TO_JP_H
3+
4+/*!
5+ \file
6+ \brief convertToJp.cpp のテスト
7+
8+ \author Satofumi KAMIMURA
9+
10+ $Id$
11+
12+ \todo かな入力のテストを追加する
13+*/
14+
15+#include <cppunit/extensions/HelperMacros.h>
16+#include "TestConvertToJp.h"
17+
18+
19+class TestConvertToJp : public CppUnit::TestFixture
20+{
21+ CPPUNIT_TEST_SUITE(TestConvertToJp);
22+ CPPUNIT_TEST(romanConvertTest);
23+ CPPUNIT_TEST_SUITE_END();
24+
25+public:
26+ void romanConvertTest(void);
27+};
28+
29+#endif /* !TEST_CONVERT_TO_JP_H */
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/input/TestConvertToRoman.h (nonexistent)
+++ trunk/libs/input/TestConvertToRoman.h (revision 1782)
@@ -0,0 +1,27 @@
1+#ifndef TEST_CONVERT_TO_ROMAN_H
2+#define TEST_CONVERT_TO_ROMAN_H
3+
4+/*!
5+ \file
6+ \brief convertToRoman.cpp のテスト
7+
8+ \author Satofumi KAMIMURA
9+
10+ $Id$
11+*/
12+
13+#include <cppunit/extensions/HelperMacros.h>
14+
15+
16+//! RomanCreator のテストクラス
17+class TestConvertToRoman : public CppUnit::TestFixture
18+{
19+ CPPUNIT_TEST_SUITE(TestConvertToRoman);
20+ CPPUNIT_TEST(convertTest);
21+ CPPUNIT_TEST_SUITE_END();
22+
23+public:
24+ void convertTest(void);
25+};
26+
27+#endif /* !TEST_CONVERT_TO_ROMAN_H */
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/input/convertToRoman.h (nonexistent)
+++ trunk/libs/input/convertToRoman.h (revision 1782)
@@ -0,0 +1,21 @@
1+#ifndef QRK_CONVERT_TO_ROMAN_H
2+#define QRK_CONVERT_TO_ROMAN_H
3+
4+/*!
5+ \file
6+ \brief 日本語のローマ字文字列への変換
7+
8+ \author Satofumi KAMIMURA
9+
10+ $Id$
11+*/
12+
13+#include <string>
14+
15+
16+namespace qrk
17+{
18+ extern std::string convertToRoman(const char* jp_text);
19+}
20+
21+#endif /* !QRK_CONVERT_TO_ROMAN_H */
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/input/Makefile (revision 1781)
+++ trunk/libs/input/Makefile (revision 1782)
@@ -17,13 +17,17 @@
1717 $(RM) *.o $(TARGET)
1818 # cd samples/ && $(MAKE) clean
1919
20+test : allTest
21+ ./allTest
22+
2023 depend :
2124 makedepend -Y -- $(INCLUDES) -- $(wildcard *.h *.cpp)
2225
23-.PHONY : all clean depend
26+.PHONY : all clean depend test
2427 ######################################################################
2528 $(INPUT_LIB) : \
26- $(INPUT_LIB)(convertJp.o) \
29+ $(INPUT_LIB)(convertToJp.o) \
30+ $(INPUT_LIB)(convertToRoman.o) \
2731
2832 convertJp.o : roman_table.h kana_table.h
2933
@@ -30,6 +34,13 @@
3034 roman_table.h kana_table.h : $(wildcard *_table.txt) $(INPUT_CONVERT_SCRIPT)
3135 ruby $(INPUT_CONVERT_SCRIPT) $*.txt > $@ || $(RM) $@
3236
37+allTest.o : ../../unittest/allTest.cpp
38+ $(CXX) $(CXXFLAGS) `cppunit-config --cflags` $< -c -o $@
39+
40+TEST_OBJS = allTest.o TestConvertToRoman.o convertToRoman.o TestConvertToJp.o convertToJp.o
41+allTest : $(TEST_OBJS)
42+ $(CXX) $(CXXFLAGS) $(TEST_OBJS) -o $@ `cppunit-config --libs` $(TEST_LDLIBS)
43+
3344 # DO NOT DELETE
3445
3546 convertJp.o: convertJp.h
--- trunk/libs/input/convertToJp.cpp (nonexistent)
+++ trunk/libs/input/convertToJp.cpp (revision 1782)
@@ -0,0 +1,21 @@
1+/*!
2+ \file
3+ \brief 日本語への変換
4+
5+ \author Satofumi KAMIMURA
6+
7+ $Id$
8+*/
9+
10+#include "convertToJp.h"
11+
12+using namespace qrk;
13+
14+
15+std::string qrk::convertToJp(const char* raw_text)
16+{
17+ (void)raw_text;
18+ // !!!
19+
20+ return "";
21+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
--- trunk/libs/input/TestConvertToJp.cpp (nonexistent)
+++ trunk/libs/input/TestConvertToJp.cpp (revision 1782)
@@ -0,0 +1,32 @@
1+/*!
2+ \file
3+ \brief convertToJp.cpp のテスト
4+
5+ \author Satofumi KAMIMURA
6+
7+ $Id$
8+*/
9+
10+#include "TestConvertToJp.h"
11+#include "convertToJp.h"
12+
13+using namespace qrk;
14+using namespace std;
15+
16+CPPUNIT_TEST_SUITE_REGISTRATION(TestConvertToJp);
17+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(TestConvertToJp, "TestConvertToJp");
18+
19+
20+// ローマ字変換のテスト
21+void TestConvertToJp::romanConvertTest(void)
22+{
23+ CPPUNIT_ASSERT_EQUAL(string("あ"), convertToJp("a"));
24+ CPPUNIT_ASSERT_EQUAL(string("あさ"), convertToJp("asa"));
25+ CPPUNIT_ASSERT_EQUAL(string("あsy"), convertToJp("asy"));
26+ CPPUNIT_ASSERT_EQUAL(string("あしゃ"), convertToJp("asya"));
27+ CPPUNIT_ASSERT_EQUAL(string("ぁ"), convertToJp("xa"));
28+ CPPUNIT_ASSERT_EQUAL(string("cば"), convertToJp("cba"));
29+ CPPUNIT_ASSERT_EQUAL(string("cか"), convertToJp("kka"));
30+ CPPUNIT_ASSERT_EQUAL(string("し"), convertToJp("shi"));
31+ CPPUNIT_ASSERT_EQUAL(string("し"), convertToJp("si"));
32+}
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
旧リポジトリブラウザで表示