Introducing Boost Test for unit-testing v3.
git-svn-id: http://svn.code.sf.net/p/utfcpp/code@141 a809a056-fc17-0410-9590-b4f493f8b08e
This commit is contained in:
parent
7075404ff0
commit
cc3c158bf8
2 changed files with 10 additions and 11 deletions
|
@ -2,5 +2,5 @@ CC = g++
|
||||||
CFLAGS = -g -Wall --std=c++11
|
CFLAGS = -g -Wall --std=c++11
|
||||||
|
|
||||||
smoketest: unit.cpp ../src/utf8.h
|
smoketest: unit.cpp ../src/utf8.h
|
||||||
$(CC) $(CFLAGS) unit.cpp -ounit
|
$(CC) $(CFLAGS) unit.cpp -ounit -lboost_unit_test_framework
|
||||||
./unit
|
./unit
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
#include <assert.h>
|
#define BOOST_TEST_DYN_LINK
|
||||||
|
#define BOOST_TEST_MODULE UTF8_CPP_UNIT
|
||||||
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
#include "../src/utf8.h"
|
#include "../src/utf8.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
BOOST_AUTO_TEST_CASE(append)
|
||||||
{
|
{
|
||||||
// append
|
|
||||||
{
|
|
||||||
string s;
|
string s;
|
||||||
utf8::append(U'\U00000448', s);
|
BOOST_CHECK_NO_THROW (utf8::append(U'\U00000448', s));
|
||||||
assert (s.length() == 2 && s[0] == '\xd1' && s[1] == '\x88');
|
BOOST_CHECK (s.length() == 2 && s[0] == '\xd1' && s[1] == '\x88');
|
||||||
|
|
||||||
s.erase();
|
s.erase();
|
||||||
utf8::append(U'\U000065e5', s);
|
BOOST_CHECK_NO_THROW(utf8::append(U'\U000065e5', s));
|
||||||
assert (s.length() == 3 && s[0] == '\xe6' && s[1] == '\x97' && s[2] == '\xa5');
|
BOOST_CHECK (s.length() == 3 && s[0] == '\xe6' && s[1] == '\x97' && s[2] == '\xa5');
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue