Skip to content

Commit f372120

Browse files
committed
[view] Add a few automatic unit tests
1 parent c6c4ef4 commit f372120

9 files changed

+93
-0
lines changed

test/view/auto/_specs.hpp

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright Louis Dionne 2013-2016
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4+
5+
#ifndef BOOST_HANA_TEST_VIEW_AUTO_SPECS_HPP
6+
#define BOOST_HANA_TEST_VIEW_AUTO_SPECS_HPP
7+
8+
#include <boost/hana/tuple.hpp>
9+
#include <boost/hana/view.hpp>
10+
11+
#include <memory>
12+
#include <vector>
13+
14+
15+
// If we want to use the automatic testing, we need to allocate the containers
16+
// over which we create views, otherwise the lifetime won't work.
17+
template <typename ...T>
18+
auto MAKE_TUPLE(T&& ...t) {
19+
using Tuple = boost::hana::tuple<typename std::decay<T>::type...>;
20+
static std::vector<std::unique_ptr<Tuple>> pool;
21+
pool.push_back(std::make_unique<Tuple>(std::forward<T>(t)...));
22+
return boost::hana::make_view(*pool.back().get());
23+
}
24+
25+
#define MAKE_TUPLE(...) ::boost::hana::make_tuple(__VA_ARGS__)
26+
#define TUPLE_TYPE(...) ::boost::hana::view<::boost::hana::tuple<__VA_ARGS__>>
27+
#define TUPLE_TAG ::boost::hana::view_tag
28+
29+
#endif // !BOOST_HANA_TEST_VIEW_AUTO_SPECS_HPP

test/view/auto/at.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright Louis Dionne 2013-2016
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4+
5+
#include "_specs.hpp"
6+
#include <auto/at.hpp>
7+
8+
int main() { }

test/view/auto/drop_front.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright Louis Dionne 2013-2016
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4+
5+
#include "_specs.hpp"
6+
#include <auto/drop_front.hpp>
7+
8+
int main() { }

test/view/auto/drop_while.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright Louis Dionne 2013-2016
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4+
5+
#include "_specs.hpp"
6+
#include <auto/drop_while.hpp>
7+
8+
int main() { }

test/view/auto/for_each.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright Louis Dionne 2013-2016
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4+
5+
#include "_specs.hpp"
6+
#include <auto/for_each.hpp>
7+
8+
int main() { }

test/view/auto/is_empty.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright Louis Dionne 2013-2016
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4+
5+
#include "_specs.hpp"
6+
#include <auto/is_empty.hpp>
7+
8+
int main() { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright Louis Dionne 2013-2016
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4+
5+
#include "_specs.hpp"
6+
#include <auto/lexicographical_compare.hpp>
7+
8+
int main() { }

test/view/auto/slice.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright Louis Dionne 2013-2016
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4+
5+
#include "_specs.hpp"
6+
#include <auto/slice.hpp>
7+
8+
int main() { }

test/view/auto/transform.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright Louis Dionne 2013-2016
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4+
5+
#include "_specs.hpp"
6+
#include <auto/transform.hpp>
7+
8+
int main() { }

0 commit comments

Comments
 (0)