summaryrefslogtreecommitdiffstats
path: root/libcxx/test/re/re.submatch/re.submatch.op/compare.pass.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2010-06-29 18:37:43 +0000
committerHoward Hinnant <hhinnant@apple.com>2010-06-29 18:37:43 +0000
commite5561b04e49023adbc330fbf3b1c94fd07deab92 (patch)
treee555b769199d656af3b98b4a20bfee289e73ad4c /libcxx/test/re/re.submatch/re.submatch.op/compare.pass.cpp
parent99e13101b2bd7500919c368504c99dbd08b6a8e9 (diff)
downloadbcm5719-llvm-e5561b04e49023adbc330fbf3b1c94fd07deab92.tar.gz
bcm5719-llvm-e5561b04e49023adbc330fbf3b1c94fd07deab92.zip
[re.submatch]
llvm-svn: 107187
Diffstat (limited to 'libcxx/test/re/re.submatch/re.submatch.op/compare.pass.cpp')
-rw-r--r--libcxx/test/re/re.submatch/re.submatch.op/compare.pass.cpp283
1 files changed, 283 insertions, 0 deletions
diff --git a/libcxx/test/re/re.submatch/re.submatch.op/compare.pass.cpp b/libcxx/test/re/re.submatch/re.submatch.op/compare.pass.cpp
new file mode 100644
index 00000000000..404a6c0858c
--- /dev/null
+++ b/libcxx/test/re/re.submatch/re.submatch.op/compare.pass.cpp
@@ -0,0 +1,283 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class BidirectionalIterator> class sub_match;
+
+// template <class BiIter>
+// bool
+// operator==(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator!=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator<(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator<=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator>=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool
+// operator==(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool
+// operator!=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool
+// operator<(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool
+// operator>(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool operator>=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool
+// operator<=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool
+// operator==(const sub_match<BiIter>& lhs,
+// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool
+// operator!=(const sub_match<BiIter>& lhs,
+// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool
+// operator<(const sub_match<BiIter>& lhs,
+// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool operator>(const sub_match<BiIter>& lhs,
+// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool
+// operator>=(const sub_match<BiIter>& lhs,
+// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+//
+// template <class BiIter, class ST, class SA>
+// bool
+// operator<=(const sub_match<BiIter>& lhs,
+// const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator==(typename iterator_traits<BiIter>::value_type const* lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator!=(typename iterator_traits<BiIter>::value_type const* lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator<(typename iterator_traits<BiIter>::value_type const* lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator>(typename iterator_traits<BiIter>::value_type const* lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator>=(typename iterator_traits<BiIter>::value_type const* lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator<=(typename iterator_traits<BiIter>::value_type const* lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator==(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const* rhs);
+//
+// template <class BiIter>
+// bool
+// operator!=(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const* rhs);
+//
+// template <class BiIter>
+// bool
+// operator<(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const* rhs);
+//
+// template <class BiIter>
+// bool
+// operator>(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const* rhs);
+//
+// template <class BiIter>
+// bool
+// operator>=(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const* rhs);
+//
+// template <class BiIter>
+// bool
+// operator<=(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const* rhs);
+//
+// template <class BiIter>
+// bool
+// operator==(typename iterator_traits<BiIter>::value_type const& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator!=(typename iterator_traits<BiIter>::value_type const& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator<(typename iterator_traits<BiIter>::value_type const& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator>(typename iterator_traits<BiIter>::value_type const& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator>=(typename iterator_traits<BiIter>::value_type const& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator<=(typename iterator_traits<BiIter>::value_type const& lhs,
+// const sub_match<BiIter>& rhs);
+//
+// template <class BiIter>
+// bool
+// operator==(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const& rhs);
+//
+// template <class BiIter>
+// bool
+// operator!=(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const& rhs);
+//
+// template <class BiIter>
+// bool
+// operator<(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const& rhs);
+//
+// template <class BiIter>
+// bool
+// operator>(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const& rhs);
+//
+// template <class BiIter>
+// bool
+// operator>=(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const& rhs);
+//
+// template <class BiIter>
+// bool
+// operator<=(const sub_match<BiIter>& lhs,
+// typename iterator_traits<BiIter>::value_type const& rhs);
+
+#include <regex>
+#include <cassert>
+
+template <class CharT>
+void
+test(const std::basic_string<CharT>& x, const std::basic_string<CharT>& y)
+{
+ typedef std::basic_string<CharT> string;
+ typedef std::sub_match<typename string::const_iterator> sub_match;
+ sub_match sm1;
+ sm1.first = x.begin();
+ sm1.second = x.end();
+ sm1.matched = true;
+ sub_match sm2;
+ sm2.first = y.begin();
+ sm2.second = y.end();
+ sm2.matched = true;
+ assert((sm1 == sm2) == (x == y));
+ assert((sm1 != sm2) == (x != y));
+ assert((sm1 < sm2) == (x < y));
+ assert((sm1 > sm2) == (x > y));
+ assert((sm1 <= sm2) == (x <= y));
+ assert((sm1 >= sm2) == (x >= y));
+ assert((x == sm2) == (x == y));
+ assert((x != sm2) == (x != y));
+ assert((x < sm2) == (x < y));
+ assert((x > sm2) == (x > y));
+ assert((x <= sm2) == (x <= y));
+ assert((x >= sm2) == (x >= y));
+ assert((sm1 == y) == (x == y));
+ assert((sm1 != y) == (x != y));
+ assert((sm1 < y) == (x < y));
+ assert((sm1 > y) == (x > y));
+ assert((sm1 <= y) == (x <= y));
+ assert((sm1 >= y) == (x >= y));
+ assert((x.c_str() == sm2) == (x == y));
+ assert((x.c_str() != sm2) == (x != y));
+ assert((x.c_str() < sm2) == (x < y));
+ assert((x.c_str() > sm2) == (x > y));
+ assert((x.c_str() <= sm2) == (x <= y));
+ assert((x.c_str() >= sm2) == (x >= y));
+ assert((sm1 == y.c_str()) == (x == y));
+ assert((sm1 != y.c_str()) == (x != y));
+ assert((sm1 < y.c_str()) == (x < y));
+ assert((sm1 > y.c_str()) == (x > y));
+ assert((sm1 <= y.c_str()) == (x <= y));
+ assert((sm1 >= y.c_str()) == (x >= y));
+ assert((x[0] == sm2) == (string(1, x[0]) == y));
+ assert((x[0] != sm2) == (string(1, x[0]) != y));
+ assert((x[0] < sm2) == (string(1, x[0]) < y));
+ assert((x[0] > sm2) == (string(1, x[0]) > y));
+ assert((x[0] <= sm2) == (string(1, x[0]) <= y));
+ assert((x[0] >= sm2) == (string(1, x[0]) >= y));
+ assert((sm1 == y[0]) == (x == string(1, y[0])));
+ assert((sm1 != y[0]) == (x != string(1, y[0])));
+ assert((sm1 < y[0]) == (x < string(1, y[0])));
+ assert((sm1 > y[0]) == (x > string(1, y[0])));
+ assert((sm1 <= y[0]) == (x <= string(1, y[0])));
+ assert((sm1 >= y[0]) == (x >= string(1, y[0])));
+}
+
+int main()
+{
+ test(std::string("123"), std::string("123"));
+ test(std::string("1234"), std::string("123"));
+ test(std::wstring(L"123"), std::wstring(L"123"));
+ test(std::wstring(L"1234"), std::wstring(L"123"));
+}
OpenPOWER on IntegriCloud