Added more test cases for utf::previous and utf::unchecked::previous to the smoke-test
git-svn-id: http://svn.code.sf.net/p/utfcpp/code@26 a809a056-fc17-0410-9590-b4f493f8b08e
This commit is contained in:
parent
5a0f1d3fc4
commit
b24be40542
1 changed files with 28 additions and 1 deletions
|
@ -8,6 +8,12 @@ using namespace std;
|
|||
|
||||
int main()
|
||||
{
|
||||
unsigned char u10ffff[] = {0xf4, 0x8f, 0xbf, 0xbf};
|
||||
unsigned char* uit = u10ffff;
|
||||
unsigned int cp_u10ffff = next (uit, u10ffff + 4);
|
||||
assert (cp_u10ffff == 0x10ffff);
|
||||
return 0;
|
||||
|
||||
//append
|
||||
unsigned char u[5] = {0,0,0,0,0};
|
||||
|
||||
|
@ -46,6 +52,17 @@ int main()
|
|||
assert (cp == 0x65e5);
|
||||
assert (w == twochars);
|
||||
|
||||
w = threechars + 9;
|
||||
cp = previous(w, threechars - 1);
|
||||
assert (cp == 0x0448);
|
||||
assert (w == threechars + 7);
|
||||
cp = previous(w, threechars -1);
|
||||
assert (cp == 0x65e5);
|
||||
assert (w == threechars + 4);
|
||||
cp = previous(w, threechars - 1);
|
||||
assert (cp == 0x10346);
|
||||
assert (w == threechars);
|
||||
|
||||
// advance
|
||||
w = twochars;
|
||||
advance (w, 2, twochars + 6);
|
||||
|
@ -132,11 +149,21 @@ int main()
|
|||
|
||||
//previous
|
||||
w = twochars + 3;
|
||||
//previous
|
||||
cp = unchecked::previous (w);
|
||||
assert (cp == 0x65e5);
|
||||
assert (w == twochars);
|
||||
|
||||
w = threechars + 9;
|
||||
cp = unchecked::previous(w);
|
||||
assert (cp == 0x0448);
|
||||
assert (w == threechars + 7);
|
||||
cp = unchecked::previous(w);
|
||||
assert (cp == 0x65e5);
|
||||
assert (w == threechars + 4);
|
||||
cp = unchecked::previous(w);
|
||||
assert (cp == 0x10346);
|
||||
assert (w == threechars);
|
||||
|
||||
// advance
|
||||
w = twochars;
|
||||
unchecked::advance (w, 2);
|
||||
|
|
Loading…
Reference in a new issue