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

Unified Diff: platform_tools/android/tests/ordered_set_tests.py

Issue 235883015: Generate tests/Android.mk from gyp (Closed) Base URL: https://skia.googlesource.com/skia.git@generate
Patch Set: Remove Android.mk/SkUserConfig.h Created 6 years, 8 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: platform_tools/android/tests/ordered_set_tests.py
diff --git a/platform_tools/android/tests/ordered_set_tests.py b/platform_tools/android/tests/ordered_set_tests.py
index 01016d9735b3b413d28bb140d281ecaebb54c113..5ec4597e7333d3015dad2efb6fa85acd46360810 100644
--- a/platform_tools/android/tests/ordered_set_tests.py
+++ b/platform_tools/android/tests/ordered_set_tests.py
@@ -28,8 +28,7 @@ class OrderedSetTest(unittest.TestCase):
self.__set = OrderedSet()
def test_methods(self):
- """
- Test methods on OrderedSet.
+ """Test methods on OrderedSet.
"""
RANGE = 10
for i in range(RANGE):
@@ -67,6 +66,38 @@ class OrderedSetTest(unittest.TestCase):
self.__set.reset()
self.assertEqual(len(self.__set), 0)
+ def test_set(self):
+ """Test OrderedSet.set().
+ """
+ # Create a set with dummy values.
+ my_set = OrderedSet()
+ RANGE = 10
+ for i in range(RANGE):
+ my_set.add(create_dummy_var(i))
+ my_len = len(my_set)
+ self.assertEqual(my_len, RANGE)
+
+ # Copy it to another set.
+ other_set = OrderedSet()
+ self.assertEqual(len(other_set), 0)
+ other_set.set(my_set)
+
+ # Both sets should contain the same values, in the same order.
+ iterator = iter(my_set)
+ for item in other_set:
+ self.assertTrue(item == iterator.next())
+ with self.assertRaises(StopIteration):
+ iterator.next()
+ self.assertEqual(my_len, len(other_set))
+
+ # But the sets are different. Changing one will not affect the other.
+ self.assertFalse(other_set is my_set)
+ other_var = 'something_else'
+ other_set.add(other_var)
+ self.assertEqual(my_len + 1, len(other_set))
+ self.assertEqual(my_len, len(my_set))
+ self.assertNotIn(other_var, my_set)
+
def main():
loader = unittest.TestLoader()
« no previous file with comments | « platform_tools/android/tests/makefile_writer_tests.py ('k') | platform_tools/android/tests/test_variables.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698