From 077d5c6a19ed1b0ce0890a049fa216500b083432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Mon, 12 Jan 2015 13:50:12 +0800 Subject: [PATCH] add test case --- TinySTL/Test/ListTest.cpp | 24 +++++++++++++++++++++++- TinySTL/Test/ListTest.h | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/TinySTL/Test/ListTest.cpp b/TinySTL/Test/ListTest.cpp index 3bca18c..407e13c 100644 --- a/TinySTL/Test/ListTest.cpp +++ b/TinySTL/Test/ListTest.cpp @@ -2,6 +2,28 @@ namespace TinySTL{ namespace ListTest{ - + void testCase1(){ + stdL l1(10, 0); + tsL l2(10, 0); + assert(TinySTL::Test::container_equal(l1, l2)); + + int arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + stdL l3(std::begin(arr), std::end(arr)); + tsL l4(std::begin(arr), std::end(arr)); + assert(TinySTL::Test::container_equal(l3, l4)); + + auto l5(l1); + auto l6(l2); + assert(TinySTL::Test::container_equal(l5, l6)); + + auto l7 = l1; + auto l8 = l2; + assert(TinySTL::Test::container_equal(l7, l8)); + } + + + void testAllCases(){ + testCase1(); + } } } \ No newline at end of file diff --git a/TinySTL/Test/ListTest.h b/TinySTL/Test/ListTest.h index f7a200c..3d29b95 100644 --- a/TinySTL/Test/ListTest.h +++ b/TinySTL/Test/ListTest.h @@ -16,6 +16,8 @@ namespace TinySTL{ template using tsL = TinySTL::list < T > ; + void testCase1(); + void testAllCases(); } }