diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-09-06 18:46:46 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-09-06 18:46:46 +0000 |
commit | 61b9a7258a7693d7f3674a5a1daf7b036ff1d382 (patch) | |
tree | ec41ed70ffca97240e76f9a78bb2dedba28f310c /test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp | |
parent | f857581820d15e410e9945d2fcd5f7163be25a96 (diff) |
Notes
Diffstat (limited to 'test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp')
-rw-r--r-- | test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp b/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp new file mode 100644 index 0000000000000..0d25edc4547b1 --- /dev/null +++ b/test/std/utilities/tuple/tuple.tuple/tuple.rel/eq.pass.cpp @@ -0,0 +1,156 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <tuple> + +// template <class... Types> class tuple; + +// template<class... TTypes, class... UTypes> +// bool +// operator==(const tuple<TTypes...>& t, const tuple<UTypes...>& u); + +// UNSUPPORTED: c++98, c++03 + +#include <tuple> +#include <string> +#include <cassert> + +int main() +{ + { + typedef std::tuple<> T1; + typedef std::tuple<> T2; + const T1 t1; + const T2 t2; + assert(t1 == t2); + assert(!(t1 != t2)); + } + { + typedef std::tuple<int> T1; + typedef std::tuple<double> T2; + const T1 t1(1); + const T2 t2(1.1); + assert(!(t1 == t2)); + assert(t1 != t2); + } + { + typedef std::tuple<int> T1; + typedef std::tuple<double> T2; + const T1 t1(1); + const T2 t2(1); + assert(t1 == t2); + assert(!(t1 != t2)); + } + { + typedef std::tuple<int, double> T1; + typedef std::tuple<double, char> T2; + const T1 t1(1, 2); + const T2 t2(1, char(2)); + assert(t1 == t2); + assert(!(t1 != t2)); + } + { + typedef std::tuple<int, double> T1; + typedef std::tuple<double, char> T2; + const T1 t1(1, 2); + const T2 t2(1, char(3)); + assert(!(t1 == t2)); + assert(t1 != t2); + } + { + typedef std::tuple<int, double> T1; + typedef std::tuple<double, char> T2; + const T1 t1(1, 2); + const T2 t2(1.1, char(2)); + assert(!(t1 == t2)); + assert(t1 != t2); + } + { + typedef std::tuple<int, double> T1; + typedef std::tuple<double, char> T2; + const T1 t1(1, 2); + const T2 t2(1.1, char(3)); + assert(!(t1 == t2)); + assert(t1 != t2); + } + { + typedef std::tuple<char, int, double> T1; + typedef std::tuple<double, char, int> T2; + const T1 t1(1, 2, 3); + const T2 t2(1, 2, 3); + assert(t1 == t2); + assert(!(t1 != t2)); + } + { + typedef std::tuple<char, int, double> T1; + typedef std::tuple<double, char, int> T2; + const T1 t1(1, 2, 3); + const T2 t2(1.1, 2, 3); + assert(!(t1 == t2)); + assert(t1 != t2); + } + { + typedef std::tuple<char, int, double> T1; + typedef std::tuple<double, char, int> T2; + const T1 t1(1, 2, 3); + const T2 t2(1, 3, 3); + assert(!(t1 == t2)); + assert(t1 != t2); + } + { + typedef std::tuple<char, int, double> T1; + typedef std::tuple<double, char, int> T2; + const T1 t1(1, 2, 3); + const T2 t2(1, 2, 4); + assert(!(t1 == t2)); + assert(t1 != t2); + } + { + typedef std::tuple<char, int, double> T1; + typedef std::tuple<double, char, int> T2; + const T1 t1(1, 2, 3); + const T2 t2(1, 3, 2); + assert(!(t1 == t2)); + assert(t1 != t2); + } + { + typedef std::tuple<char, int, double> T1; + typedef std::tuple<double, char, int> T2; + const T1 t1(1, 2, 3); + const T2 t2(1.1, 2, 2); + assert(!(t1 == t2)); + assert(t1 != t2); + } + { + typedef std::tuple<char, int, double> T1; + typedef std::tuple<double, char, int> T2; + const T1 t1(1, 2, 3); + const T2 t2(1.1, 3, 3); + assert(!(t1 == t2)); + assert(t1 != t2); + } + { + typedef std::tuple<char, int, double> T1; + typedef std::tuple<double, char, int> T2; + const T1 t1(1, 2, 3); + const T2 t2(1.1, 3, 2); + assert(!(t1 == t2)); + assert(t1 != t2); + } +#if _LIBCPP_STD_VER > 11 + { + typedef std::tuple<char, int, double> T1; + typedef std::tuple<double, char, int> T2; + constexpr T1 t1(1, 2, 3); + constexpr T2 t2(1.1, 3, 2); + static_assert(!(t1 == t2), ""); + static_assert(t1 != t2, ""); + } +#endif +} |