| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "courgette/third_party/qsufsort.h" | 5 #include "courgette/third_party/qsufsort.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cstring> | 10 #include <cstring> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 16 |
| 18 TEST(QSufSortTest, Sort) { | 17 TEST(QSufSortTest, Sort) { |
| 19 const char* test_cases[] = { | 18 const char* test_cases[] = { |
| 20 "", | 19 "", |
| 21 "a", | 20 "a", |
| 22 "za", | 21 "za", |
| 23 "CACAO", | 22 "CACAO", |
| 24 "banana", | 23 "banana", |
| 25 "tobeornottobe", | 24 "tobeornottobe", |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 EXPECT_LE(pos, old_size - match_len) << "test_case[" << idx << "]"; | 127 EXPECT_LE(pos, old_size - match_len) << "test_case[" << idx << "]"; |
| 129 EXPECT_EQ(0, ::memcmp(old_buf + pos, new_buf, match_len)) | 128 EXPECT_EQ(0, ::memcmp(old_buf + pos, new_buf, match_len)) |
| 130 << "test_case[" << idx << "]"; | 129 << "test_case[" << idx << "]"; |
| 131 } | 130 } |
| 132 if (test_case.exp_pos >= 0) { | 131 if (test_case.exp_pos >= 0) { |
| 133 EXPECT_EQ(test_case.exp_pos, pos) << "test_case[" << idx << "]"; | 132 EXPECT_EQ(test_case.exp_pos, pos) << "test_case[" << idx << "]"; |
| 134 } | 133 } |
| 135 EXPECT_EQ(test_case.exp_match_len, match_len) << "test_case[" << idx << "]"; | 134 EXPECT_EQ(test_case.exp_match_len, match_len) << "test_case[" << idx << "]"; |
| 136 } | 135 } |
| 137 } | 136 } |
| OLD | NEW |