From 7d8d72b8f249711c7bc9d1e6a32b816cefa526cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Thu, 18 Dec 2014 10:19:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95=E8=BE=85?= =?UTF-8?q?=E5=8A=A9=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/Test/TestUtil.h | 36 +++++++++++++++++++++++++++++++++ TinySTL/TinySTL.vcxproj | 4 ++++ TinySTL/TinySTL.vcxproj.filters | 6 ++++++ 3 files changed, 46 insertions(+) create mode 100644 TinySTL/Test/TestUtil.h diff --git a/TinySTL/Test/TestUtil.h b/TinySTL/Test/TestUtil.h new file mode 100644 index 0000000..30d8867 --- /dev/null +++ b/TinySTL/Test/TestUtil.h @@ -0,0 +1,36 @@ +#ifndef _TEST_UTIL_H_ +#define _TEST_UTIL_H_ + +#include +#include + +#include "..\Algorithm.h" + +namespace TinySTL{ + namespace Test{ + + template + void print_container(Container& container){//²»ÊÇÿһ¸öÈÝÆ÷¶¼ÓÐconst_iterator + std::cout << "Container : "; + for (auto val : container){ + std::cout << val << " "; + } + std::cout << std::endl; + } + + template + bool container_equal(Container1& con1, Container2& con2){//²»ÊÇÿһ¸öÈÝÆ÷¶¼ÓÐconst_iterator + /*return TinySTL::equal(std::begin(con1), std::end(con1), + std::begin(con2));*/ + auto first1 = std::begin(con1), last1 = std::end(con1); + auto first2 = std::begin(con2), last2 = std::end(con2); + for (; first1 != last1 && first2 != last2; ++first1, ++first2){ + if (*first1 != *first2) + return false; + } + return (first1 == last1 && first2 == last2); + } + } +} + +#endif \ No newline at end of file diff --git a/TinySTL/TinySTL.vcxproj b/TinySTL/TinySTL.vcxproj index 94ec448..a70251b 100644 --- a/TinySTL/TinySTL.vcxproj +++ b/TinySTL/TinySTL.vcxproj @@ -102,11 +102,15 @@ + + + + diff --git a/TinySTL/TinySTL.vcxproj.filters b/TinySTL/TinySTL.vcxproj.filters index eff29ab..82815b4 100644 --- a/TinySTL/TinySTL.vcxproj.filters +++ b/TinySTL/TinySTL.vcxproj.filters @@ -98,5 +98,11 @@ 头文件 + + Test + + + + \ No newline at end of file