summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2016-03-03 22:13:27 +0100
committerMurray Cumming <murrayc@murrayc.com>2016-03-07 10:47:04 +0100
commit8e8b2f31e15b21a271c7314fb25114620cbd481e (patch)
treefdb2ff06f6f13dfefeadbffdc2d125a46531d0ef /tests
parentc43d9748c8c3fe365924d4988bc36d98b126bd9d (diff)
downloadsigc++-8e8b2f31e15b21a271c7314fb25114620cbd481e.tar.gz
Update tuple-utils from murrayc-tuple-utils.
tuple_transform_each() now iterates in order, instead of in reverse, though that didn't seem to matter to how we used it in libsigc++.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_tuple_transform_each.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_tuple_transform_each.cc b/tests/test_tuple_transform_each.cc
index 00e76a0..b1ff020 100644
--- a/tests/test_tuple_transform_each.cc
+++ b/tests/test_tuple_transform_each.cc
@@ -261,6 +261,33 @@ test_tuple_transform_each_stdref_non_copyable() {
"unexpected transform_each()ed tuple type");
}
+static std::string correct_sequence_output;
+
+template <class T_element_from>
+class transform_each_correct_sequence {
+public:
+ static decltype(auto)
+ transform(int from) {
+ correct_sequence_output += std::to_string(from);
+ return std::to_string(from);
+ }
+};
+
+void
+test_tuple_transform_each_correct_sequence() {
+ correct_sequence_output.clear();
+ auto t = std::make_tuple(1, 2, 3);
+ sigc::internal::tuple_transform_each<transform_each_correct_sequence>(t);
+ //std::cout << "correct_sequence_output: " << correct_sequence_output << std::endl;
+ assert(correct_sequence_output == "123");
+}
+
+void
+test_tuple_transform_each_empty_tuple() {
+ auto t = std::tuple<>();
+ sigc::internal::tuple_transform_each<transform_to_string>(t);
+}
+
int
main() {
test_tuple_type_transform_each_same_types();
@@ -274,5 +301,9 @@ main() {
test_tuple_transform_each_stdref();
test_tuple_transform_each_stdref_non_copyable();
+ test_tuple_transform_each_correct_sequence();
+
+ test_tuple_transform_each_empty_tuple();
+
return EXIT_SUCCESS;
}