From e12a6b52bb9b5fd93430d549fec98c725d14fb6b Mon Sep 17 00:00:00 2001
From: namark <namark@disroot.org>
Date: Sat, 22 May 2021 14:21:00 +0400
Subject: [PATCH] Tests for is_range_v traits,

which now supports ADL lookup of begin and end functions,
that change happened in previous commit, hidden by the file split.
---
 unit_tests/algorithm.cpp | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/unit_tests/algorithm.cpp b/unit_tests/algorithm.cpp
index 64ca939..2c4e695 100644
--- a/unit_tests/algorithm.cpp
+++ b/unit_tests/algorithm.cpp
@@ -3,6 +3,7 @@
 #include <numeric>
 #include "simple/support/algorithm.hpp"
 
+
 using namespace simple::support;
 
 void MultidimentionalIteration()
@@ -196,12 +197,34 @@ constexpr bool Constexprness()
 	return true;
 }
 
+namespace adl_range_test
+{
+	struct segment
+	{
+		int* start;
+		int size;
+	};
+	int* begin(const segment& x) { return x.start; }
+	int* end(const segment& x) { return x.start + x.size; }
+}
+
+template <typename T> class show;
+void TypeTraits()
+{
+	static_assert(is_range_v<int(&)[2]>);
+	static_assert(!is_range_v<int[2]>);
+	static_assert(is_range_v<std::array<int,2>>);
+	static_assert(is_range_v<std::array<int,2>&>);
+	static_assert(is_range_v<adl_range_test::segment>);
+}
+
 int main()
 {
 	MultidimentionalIteration();
 	ContainerAsNumber();
 	IteratorRange();
 	Variance();
+	TypeTraits();
 	static_assert(Constexprness());
 	return 0;
 }
-- 
GitLab