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

Unified Diff: pkg/smoke/lib/src/common.dart

Issue 204143002: Changes in smoke in preparation of polymer's codegen: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
« no previous file with comments | « pkg/smoke/lib/smoke.dart ('k') | pkg/smoke/lib/static.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/smoke/lib/src/common.dart
diff --git a/pkg/smoke/lib/src/common.dart b/pkg/smoke/lib/src/common.dart
index 2f0f9b4e18a8d62db440687b2015aef586575002..1d73e4ff836ceb04cd921ac62177cbc9305d8311 100644
--- a/pkg/smoke/lib/src/common.dart
+++ b/pkg/smoke/lib/src/common.dart
@@ -77,3 +77,32 @@ int maxArgs(Function f) {
if (f is _Func0) return 0;
return -1;
}
+
+/// Shallow comparison of two lists.
+bool compareLists(List a, List b, {bool unordered: false}) {
+ if (a == null && b != null) return false;
+ if (a != null && b == null) return false;
+ if (a.length != b.length) return false;
+ if (unordered) {
+ var bSet = new Set()..addAll(b);
+ for (int i = 0; i < a.length; i++) {
+ if (!bSet.contains(a[i])) return false;
+ }
+ } else {
+ for (int i = 0; i < a.length; i++) {
+ if (a[i] != b[i]) return false;
+ }
+ }
+ return true;
+}
+
+/// Shallow comparison of two maps.
+bool compareMaps(Map a, Map b) {
+ if (a == null && b != null) return false;
+ if (a != null && b == null) return false;
+ if (a.length != b.length) return false;
+ for (var k in a.keys) {
+ if (!b.containsKey(k) || a[k] != b[k]) return false;
+ }
+ return true;
+}
« no previous file with comments | « pkg/smoke/lib/smoke.dart ('k') | pkg/smoke/lib/static.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698