diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2023-02-01 15:29:14 +0800 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2023-02-01 15:29:14 +0800 |
commit | dd2fde2aa87372189e2548ef556b50a0b8ee45f2 (patch) | |
tree | 8d8c4461b6b4ec0b7f617d1b2dc3f48766730242 /lib/utfcpp/v3/tests/test_unchecked_iterator.h | |
parent | 782fdb71b4c6131927317c0de72f3b72a2d37258 (diff) | |
download | fork-ledger-dd2fde2aa87372189e2548ef556b50a0b8ee45f2.tar.gz fork-ledger-dd2fde2aa87372189e2548ef556b50a0b8ee45f2.tar.bz2 fork-ledger-dd2fde2aa87372189e2548ef556b50a0b8ee45f2.zip |
Updated lib/utfcpp
* Squashed 'lib/utfcpp/' content from commit 79835a5fa
git-subtree-dir: lib/utfcpp
git-subtree-split: 79835a5fa57271f07a90ed36123e30ae9741178e
* Change include path to utfcpp
Diffstat (limited to 'lib/utfcpp/v3/tests/test_unchecked_iterator.h')
-rw-r--r-- | lib/utfcpp/v3/tests/test_unchecked_iterator.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/utfcpp/v3/tests/test_unchecked_iterator.h b/lib/utfcpp/v3/tests/test_unchecked_iterator.h new file mode 100644 index 00000000..4294232d --- /dev/null +++ b/lib/utfcpp/v3/tests/test_unchecked_iterator.h @@ -0,0 +1,36 @@ +#ifndef UTF8_FOR_CPP_TEST_UNCHECKED_ITERATOR_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 +#define UTF8_FOR_CPP_TEST_UNCHECKED_ITERATOR_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 + +#include "utf8/unchecked.h" + +using namespace utf8::unchecked; + + +TEST(UnCheckedIteratrTests, test_increment) +{ + const char* threechars = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88"; + utf8::unchecked::iterator<const char*> it(threechars); + utf8::unchecked::iterator<const char*> it2 = it; + EXPECT_EQ (it2, it); + EXPECT_EQ (*it, 0x10346); + EXPECT_EQ (*(++it), 0x65e5); + EXPECT_EQ ((*it++), 0x65e5); + EXPECT_EQ (*it, 0x0448); + EXPECT_NE (it, it2); + utf8::unchecked::iterator<const char*> endit (threechars + 9); + EXPECT_EQ (++it, endit); +} + +TEST(UnCheckedIteratrTests, test_decrement) +{ + const char* threechars = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88"; + utf8::unchecked::iterator<const char*> it(threechars+9); + EXPECT_EQ (*(--it), 0x0448); + EXPECT_EQ ((*it--), 0x0448); + EXPECT_EQ (*it, 0x65e5); + EXPECT_EQ (--it, utf8::unchecked::iterator<const char*>(threechars)); + EXPECT_EQ (*it, 0x10346); + +} + +#endif |