Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: pkg/analyzer/test/src/summary/incremental_cache_test.dart

Issue 2060433003: Optimize paths comparision in source closure sorting. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/summary/incremental_cache_test.dart
diff --git a/pkg/analyzer/test/src/summary/incremental_cache_test.dart b/pkg/analyzer/test/src/summary/incremental_cache_test.dart
index 695cb51ac3e76f06ff0210ea8bfa6ccb6f9de2e6..3a8cfc5345d5d4ae55b5b961aa37e3d37a6b08d9 100644
--- a/pkg/analyzer/test/src/summary/incremental_cache_test.dart
+++ b/pkg/analyzer/test/src/summary/incremental_cache_test.dart
@@ -14,9 +14,57 @@ import '../abstract_single_unit.dart';
main() {
groupSep = ' | ';
+ runReflectiveTests(ComparePathsTest);
runReflectiveTests(IncrementalCacheTest);
}
+@reflectiveTest
+class ComparePathsTest extends AbstractSingleUnitTest {
+ void test_empty() {
+ expect(comparePaths('', ''), 0);
+ }
+
+ void test_equal() {
+ expect(comparePaths('abc', 'abc'), 0);
+ }
+
+ void test_longer_suffixAfter() {
+ expect(comparePaths('aab', 'aa'), 1);
+ }
+
+ void test_longer_suffixBefore() {
+ expect(comparePaths('aaa', 'ab'), -1);
+ }
+
+ void test_longer_suffixSame() {
+ expect(comparePaths('aaa', 'aa'), 1);
+ }
+
+ void test_sameLength_before0() {
+ expect(comparePaths('aaa', 'bbb'), -1);
+ }
+
+ void test_sameLength_before1() {
+ expect(comparePaths('aaa', 'bba'), -1);
+ }
+
+ void test_sameLength_before2() {
+ expect(comparePaths('aaa', 'bba'), -1);
+ }
+
+ void test_shorter_suffixAfter() {
+ expect(comparePaths('ab', 'aaa'), 1);
+ }
+
+ void test_shorter_suffixBefore() {
+ expect(comparePaths('aa', 'aab'), -1);
+ }
+
+ void test_shorter_suffixSame() {
+ expect(comparePaths('aa', 'aaa'), -1);
+ }
+}
+
/**
* TODO(scheglov) write more tests for invalidation.
*/

Powered by Google App Engine
This is Rietveld 408576698