| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.h" | 5 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.h" |
| 6 | 6 |
| 7 #include "testing/platform_test.h" | 7 #include "testing/platform_test.h" |
| 8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
| 12 |
| 9 class TabSwitcherUtilsTest : public PlatformTest { | 13 class TabSwitcherUtilsTest : public PlatformTest { |
| 10 protected: | 14 protected: |
| 11 // Checks that the computed updates/deletions/insertions to go from |initial| | 15 // Checks that the computed updates/deletions/insertions to go from |initial| |
| 12 // to |final| correctly match the expected updates/deletions/insertions. | 16 // to |final| correctly match the expected updates/deletions/insertions. |
| 13 void TestLevenshtein(std::vector<size_t> const& initial, | 17 void TestLevenshtein(std::vector<size_t> const& initial, |
| 14 std::vector<size_t> const& final, | 18 std::vector<size_t> const& final, |
| 15 std::vector<size_t> const& expectedSubstitutions, | 19 std::vector<size_t> const& expectedSubstitutions, |
| 16 std::vector<size_t> const& expectedDeletions, | 20 std::vector<size_t> const& expectedDeletions, |
| 17 std::vector<size_t> const& expectedInsertions) { | 21 std::vector<size_t> const& expectedInsertions) { |
| 18 std::vector<size_t> substitutions; | 22 std::vector<size_t> substitutions; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 TEST_F(TabSwitcherUtilsTest, | 121 TEST_F(TabSwitcherUtilsTest, |
| 118 TestLevenshteinPreferInsertionsAndDeletionsOverSubstitutions) { | 122 TestLevenshteinPreferInsertionsAndDeletionsOverSubstitutions) { |
| 119 std::vector<size_t> initial = {0, 1}; | 123 std::vector<size_t> initial = {0, 1}; |
| 120 std::vector<size_t> final = {1, 2}; | 124 std::vector<size_t> final = {1, 2}; |
| 121 std::vector<size_t> expectedSubstitutions = {}; | 125 std::vector<size_t> expectedSubstitutions = {}; |
| 122 std::vector<size_t> expectedDeletions = {0}; | 126 std::vector<size_t> expectedDeletions = {0}; |
| 123 std::vector<size_t> expectedInsertions = {1}; | 127 std::vector<size_t> expectedInsertions = {1}; |
| 124 TestLevenshtein(initial, final, expectedSubstitutions, expectedDeletions, | 128 TestLevenshtein(initial, final, expectedSubstitutions, expectedDeletions, |
| 125 expectedInsertions); | 129 expectedInsertions); |
| 126 } | 130 } |
| OLD | NEW |