diff options
author | Dianne Hackborn <hackbod@google.com> | 2013-07-31 17:52:07 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2013-07-31 17:52:07 -0700 |
commit | 8b7bc13e217034e0ddd00f9033463190f50dce88 (patch) | |
tree | af54af27930da9b20e5bbbd30648f08f36b41cd7 /tests/ActivityTests | |
parent | f94b34f5397d92080c188277b062537480c05b7d (diff) | |
download | frameworks_base-8b7bc13e217034e0ddd00f9033463190f50dce88.zip frameworks_base-8b7bc13e217034e0ddd00f9033463190f50dce88.tar.gz frameworks_base-8b7bc13e217034e0ddd00f9033463190f50dce88.tar.bz2 |
Fix issue #10115327: MapCollections need to implement equals
Change-Id: I8e7b6dd092442f3870aa1a36bd2a7cd974177146
Diffstat (limited to 'tests/ActivityTests')
-rw-r--r-- | tests/ActivityTests/src/com/google/android/test/activity/ArrayMapTests.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/ArrayMapTests.java b/tests/ActivityTests/src/com/google/android/test/activity/ArrayMapTests.java index 28e86bf..4ad6dc7 100644 --- a/tests/ActivityTests/src/com/google/android/test/activity/ArrayMapTests.java +++ b/tests/ActivityTests/src/com/google/android/test/activity/ArrayMapTests.java @@ -146,6 +146,65 @@ public class ArrayMapTests { } } + if (map.entrySet().hashCode() != array.entrySet().hashCode()) { + Log.e("test", "Entry set hash codes differ: map=0x" + + Integer.toHexString(map.entrySet().hashCode()) + " array=0x" + + Integer.toHexString(array.entrySet().hashCode())); + return false; + } + + if (!map.entrySet().equals(array.entrySet())) { + Log.e("test", "Failed calling equals on map entry set against array set"); + return false; + } + + if (!array.entrySet().equals(map.entrySet())) { + Log.e("test", "Failed calling equals on array entry set against map set"); + return false; + } + + if (map.keySet().hashCode() != array.keySet().hashCode()) { + Log.e("test", "Key set hash codes differ: map=0x" + + Integer.toHexString(map.keySet().hashCode()) + " array=0x" + + Integer.toHexString(array.keySet().hashCode())); + return false; + } + + if (!map.keySet().equals(array.keySet())) { + Log.e("test", "Failed calling equals on map key set against array set"); + return false; + } + + if (!array.keySet().equals(map.keySet())) { + Log.e("test", "Failed calling equals on array key set against map set"); + return false; + } + + if (!map.keySet().containsAll(array.keySet())) { + Log.e("test", "Failed map key set contains all of array key set"); + return false; + } + + if (!array.keySet().containsAll(map.keySet())) { + Log.e("test", "Failed array key set contains all of map key set"); + return false; + } + + if (!array.containsAll(map.keySet())) { + Log.e("test", "Failed array contains all of map key set"); + return false; + } + + if (!map.entrySet().containsAll(array.entrySet())) { + Log.e("test", "Failed map entry set contains all of array entry set"); + return false; + } + + if (!array.entrySet().containsAll(map.entrySet())) { + Log.e("test", "Failed array entry set contains all of map entry set"); + return false; + } + return true; } |