aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/utfcpp/tests/test_checked_iterator.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-11-04 14:18:54 +0100
committerStefan Boberg <[email protected]>2021-11-04 14:19:05 +0100
commit472569d4a5f2daaef7e234d93b417ccb650be624 (patch)
tree085c33f178855ad5ffe48b01bf99d41516ffa011 /thirdparty/utfcpp/tests/test_checked_iterator.cpp
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
downloadzen-472569d4a5f2daaef7e234d93b417ccb650be624.tar.xz
zen-472569d4a5f2daaef7e234d93b417ccb650be624.zip
Renamed 3rdparty -> thirdparty for legal compliance
Diffstat (limited to 'thirdparty/utfcpp/tests/test_checked_iterator.cpp')
-rw-r--r--thirdparty/utfcpp/tests/test_checked_iterator.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/thirdparty/utfcpp/tests/test_checked_iterator.cpp b/thirdparty/utfcpp/tests/test_checked_iterator.cpp
new file mode 100644
index 000000000..4c44834fd
--- /dev/null
+++ b/thirdparty/utfcpp/tests/test_checked_iterator.cpp
@@ -0,0 +1,31 @@
+#include "gtest/gtest.h"
+#include "utf8.h"
+
+using namespace utf8;
+
+
+TEST(CheckedIteratrTests, test_increment)
+{
+ const char* threechars = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88";
+ utf8::iterator<const char*> it(threechars, threechars, threechars + 9);
+ utf8::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::iterator<const char*> endit (threechars + 9, threechars, threechars + 9);
+ EXPECT_EQ (++it, endit);
+}
+
+TEST(CheckedIteratrTests, test_decrement)
+{
+ const char* threechars = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88";
+ utf8::iterator<const char*> it(threechars+9, threechars, threechars + 9);
+ EXPECT_EQ (*(--it), 0x0448);
+ EXPECT_EQ ((*it--), 0x0448);
+ EXPECT_EQ (*it, 0x65e5);
+ EXPECT_EQ (--it, utf8::iterator<const char*>(threechars, threechars, threechars + 9));
+ EXPECT_EQ (*it, 0x10346);
+}