From c82d80085e8162ee1446a583c7f48034c6adeadf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Tue, 30 Dec 2014 11:11:04 +0800 Subject: [PATCH] add --- TinySTL/Test/SuffixArrayTest.cpp | 21 +++++++++++++++++++++ TinySTL/Test/SuffixArrayTest.h | 16 ++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 TinySTL/Test/SuffixArrayTest.cpp create mode 100644 TinySTL/Test/SuffixArrayTest.h diff --git a/TinySTL/Test/SuffixArrayTest.cpp b/TinySTL/Test/SuffixArrayTest.cpp new file mode 100644 index 0000000..2d94828 --- /dev/null +++ b/TinySTL/Test/SuffixArrayTest.cpp @@ -0,0 +1,21 @@ +#include "SuffixArrayTest.h" + +namespace TinySTL{ + namespace SuffixArrayTest{ + void testCase1(){ + char arr[] = { 'a', 'a', 'b', 'a', 'a', 'a', 'a', 'b' }; + + TinySTL::suffix_array sa(arr, 8); + auto v = sa.suffixArray(); + auto t = std::vector {3, 4, 5, 0, 6, 1, 7, 2}; + assert(TinySTL::Test::container_equal(v, t)); + } + } +} + +using namespace TinySTL::SuffixArrayTest; +int main(){ + testCase1(); + system("pause"); + return 0; +} \ No newline at end of file diff --git a/TinySTL/Test/SuffixArrayTest.h b/TinySTL/Test/SuffixArrayTest.h new file mode 100644 index 0000000..d7e5001 --- /dev/null +++ b/TinySTL/Test/SuffixArrayTest.h @@ -0,0 +1,16 @@ +#ifndef _SUFFIX_ARRAY_TEST_H_ +#define _SUFFIX_ARRAY_TEST_H_ + +#include "TestUtil.h" + +#include "../SuffixArray.h" + +#include + +namespace TinySTL{ + namespace SuffixArrayTest{ + + } +} + +#endif \ No newline at end of file