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