[818] | 1 | /**
|
---|
| 2 | @file jenga.cpp
|
---|
| 3 |
|
---|
| 4 | @brief jengaプロジェクト内のコードに対するテスト。
|
---|
| 5 | */
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | #include "stdafx.h"
|
---|
| 9 |
|
---|
[819] | 10 | #include <boost/assign.hpp>
|
---|
[818] | 11 | #include <jenga/include/jenga.h>
|
---|
| 12 |
|
---|
[819] | 13 | using namespace boost::assign;
|
---|
[818] | 14 | using namespace Jenga::Common;
|
---|
| 15 |
|
---|
| 16 | /**
|
---|
| 17 | @breif Jenga/Common/String.hの関数などに対するテスト。
|
---|
| 18 | */
|
---|
| 19 | BOOST_AUTO_TEST_CASE( JengaCommonString )
|
---|
| 20 | {
|
---|
[819] | 21 | std::vector<std::string> v;
|
---|
| 22 | v += "ABC", "def", "123";
|
---|
| 23 |
|
---|
| 24 | BOOST_CHECK(IsExistString(v, "123"));
|
---|
| 25 | BOOST_CHECK(!IsExistString(v, "abc"));
|
---|
| 26 |
|
---|
[818] | 27 | std::string s = "Dete koi dete koi ike no koi";
|
---|
| 28 | StringReplace(s, "koi", "ike");
|
---|
| 29 | BOOST_CHECK_EQUAL(s, "Dete ike dete ike ike no ike");
|
---|
[819] | 30 |
|
---|
[818] | 31 | BOOST_CHECK_EQUAL(ToString(42), "42");
|
---|
| 32 | BOOST_CHECK_EQUAL(ToString(-7), "-7");
|
---|
[819] | 33 |
|
---|
[818] | 34 | BOOST_CHECK_EQUAL(ToString(std::wstring(L"ABC123")), "ABC123");
|
---|
[819] | 35 |
|
---|
[818] | 36 | BOOST_CHECK(ToWString(std::string("ABC123")) == L"ABC123");
|
---|
[819] | 37 |
|
---|
[818] | 38 | BOOST_CHECK(IsIdentifierTopChar('a'));
|
---|
| 39 | BOOST_CHECK(IsIdentifierTopChar('z'));
|
---|
| 40 | BOOST_CHECK(IsIdentifierTopChar('A'));
|
---|
| 41 | BOOST_CHECK(IsIdentifierTopChar('Z'));
|
---|
| 42 | BOOST_CHECK(IsIdentifierTopChar('_'));
|
---|
| 43 | BOOST_CHECK(IsIdentifierChar('a'));
|
---|
| 44 | BOOST_CHECK(IsIdentifierChar('z'));
|
---|
| 45 | BOOST_CHECK(IsIdentifierChar('A'));
|
---|
| 46 | BOOST_CHECK(IsIdentifierChar('Z'));
|
---|
| 47 | BOOST_CHECK(IsIdentifierChar('_'));
|
---|
| 48 | BOOST_CHECK(IsIdentifierChar('0'));
|
---|
| 49 | BOOST_CHECK(IsIdentifierChar('9'));
|
---|
| 50 | }
|
---|