summaryrefslogtreecommitdiff
path: root/lib/utfcpp/v4/tests/test_unchecked_iterator.h
diff options
context:
space:
mode:
authorAlexis Hildebrandt <afh@surryhill.net>2023-12-07 16:43:46 +0100
committerAlexis Hildebrandt <afh@surryhill.net>2023-12-10 19:01:27 +0100
commitf017686dd4720bac373e8fcd5b779777a83162ec (patch)
tree408f1a27aa999bce0646f21c76330e3f252e1c76 /lib/utfcpp/v4/tests/test_unchecked_iterator.h
parent3cfad2570d7fe8aa5d88de3797797d695d4fbe06 (diff)
downloadfork-ledger-f017686dd4720bac373e8fcd5b779777a83162ec.tar.gz
fork-ledger-f017686dd4720bac373e8fcd5b779777a83162ec.tar.bz2
fork-ledger-f017686dd4720bac373e8fcd5b779777a83162ec.zip
utfcpp: Update to 4.0.4
Diffstat (limited to 'lib/utfcpp/v4/tests/test_unchecked_iterator.h')
-rw-r--r--lib/utfcpp/v4/tests/test_unchecked_iterator.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/utfcpp/v4/tests/test_unchecked_iterator.h b/lib/utfcpp/v4/tests/test_unchecked_iterator.h
new file mode 100644
index 00000000..4294232d
--- /dev/null
+++ b/lib/utfcpp/v4/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