diff --git a/TinySTL/Test/SuffixArrayTest.cpp b/TinySTL/Test/SuffixArrayTest.cpp index 2d94828..a3ae8e8 100644 --- a/TinySTL/Test/SuffixArrayTest.cpp +++ b/TinySTL/Test/SuffixArrayTest.cpp @@ -2,20 +2,29 @@ namespace TinySTL{ namespace SuffixArrayTest{ - void testCase1(){ + void testCase(){ 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)); + auto sa1 = sa.suffixArray(); + auto sa2 = TinySTL::suffix_array::array_type{3, 4, 5, 0, 6, 1, 7, 2}; + assert(TinySTL::Test::container_equal(sa1, sa2)); + + auto ra1 = sa.rankArray(); + auto ra2 = TinySTL::suffix_array::array_type{ 3, 5, 7, 0, 1, 2, 4, 6 }; + assert(TinySTL::Test::container_equal(ra1, ra2)); + + auto ha1 = sa.heightArray(); + auto ha2 = TinySTL::suffix_array::array_type{ 3, 2, 3, 1, 2, 0, 1 }; + assert(TinySTL::Test::container_equal(ha1, ha2)); } } } using namespace TinySTL::SuffixArrayTest; int main(){ - testCase1(); + testCase(); + system("pause"); return 0; } \ No newline at end of file diff --git a/TinySTL/Test/SuffixArrayTest.h b/TinySTL/Test/SuffixArrayTest.h index d7e5001..e6ff62b 100644 --- a/TinySTL/Test/SuffixArrayTest.h +++ b/TinySTL/Test/SuffixArrayTest.h @@ -9,7 +9,7 @@ namespace TinySTL{ namespace SuffixArrayTest{ - + void testCase(); } }