source: dev/branches/egtra/ab5.0/abdev/ab-test/jenga.cpp

Last change on this file was 819, checked in by イグトランス (egtra), 14 years ago

Jenga/common/String.cppのテストを少し充実させた。

File size: 1.3 KB
Line 
1/**
2@file jenga.cpp
3
4@brief jengaプロジェクト内のコードに対するテスト。
5*/
6
7
8#include "stdafx.h"
9
10#include <boost/assign.hpp>
11#include <jenga/include/jenga.h>
12
13using namespace boost::assign;
14using namespace Jenga::Common;
15
16/**
17@breif Jenga/Common/String.hの関数などに対するテスト。
18*/
19BOOST_AUTO_TEST_CASE( JengaCommonString )
20{
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
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");
30
31 BOOST_CHECK_EQUAL(ToString(42), "42");
32 BOOST_CHECK_EQUAL(ToString(-7), "-7");
33
34 BOOST_CHECK_EQUAL(ToString(std::wstring(L"ABC123")), "ABC123");
35
36 BOOST_CHECK(ToWString(std::string("ABC123")) == L"ABC123");
37
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}
Note: See TracBrowser for help on using the repository browser.