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

Side by Side Diff: platform_tools/android/tests/var_dict_tests.py

Issue 198063002: Updates to Android.mk generation. (Closed) Base URL: https://skia.googlesource.com/skia.git@android_mk
Patch Set: Add a comment explaining the motivation of OrderedSet. 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 unified diff | Download patch
« no previous file with comments | « platform_tools/android/tests/utils.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright 2014 Google Inc. 3 # Copyright 2014 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 """ 8 """
9 Test the VarsDict. 9 Test the VarsDict.
10 """ 10 """
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 self.assertIsInstance(v_dict[key], OrderedSet) 53 self.assertIsInstance(v_dict[key], OrderedSet)
54 self.assertEqual(len(v_dict[key]), 0) 54 self.assertEqual(len(v_dict[key]), 0)
55 self.assert_consistency(v_dict) 55 self.assert_consistency(v_dict)
56 56
57 def test_intersection(self): 57 def test_intersection(self):
58 v_dict_list = [] 58 v_dict_list = []
59 RANGE = 10 59 RANGE = 10
60 for i in range(RANGE): 60 for i in range(RANGE):
61 v_dict = VarsDict() 61 v_dict = VarsDict()
62 # Add something common to each field, as well as a unique entry 62 # Add something common to each field, as well as a unique entry
63 v_dict.LOCAL_CFLAGS.add('cflag') 63 for key in v_dict.keys():
64 v_dict.LOCAL_CFLAGS.add(str(i)) 64 v_dict[key].add(key.lower())
65 65 v_dict[key].add(str(i))
66 v_dict.LOCAL_CPPFLAGS.add('cppflag')
67 v_dict.LOCAL_CPPFLAGS.add(str(i))
68
69 v_dict.LOCAL_SRC_FILES.add('src')
70 v_dict.LOCAL_SRC_FILES.add(str(i))
71
72 v_dict.LOCAL_SHARED_LIBRARIES.add('shared')
73 v_dict.LOCAL_SHARED_LIBRARIES.add(str(i))
74
75 v_dict.LOCAL_STATIC_LIBRARIES.add('static')
76 v_dict.LOCAL_STATIC_LIBRARIES.add(str(i))
77
78 v_dict.LOCAL_C_INCLUDES.add('includes')
79 v_dict.LOCAL_C_INCLUDES.add(str(i))
80
81 v_dict.LOCAL_EXPORT_C_INCLUDE_DIRS.add('exports')
82 v_dict.LOCAL_EXPORT_C_INCLUDE_DIRS.add(str(i))
83
84 v_dict.KNOWN_TARGETS.add('known')
85 v_dict.KNOWN_TARGETS.add(str(i))
86 66
87 self.assert_consistency(v_dict) 67 self.assert_consistency(v_dict)
88 68
89 v_dict_list.append(v_dict) 69 v_dict_list.append(v_dict)
90 70
91 intersection = vars_dict_lib.intersect(v_dict_list) 71 intersection = vars_dict_lib.intersect(v_dict_list)
92 72
93 self.assert_consistency(intersection) 73 self.assert_consistency(intersection)
94 74
95 for key in intersection.keys(): 75 for key in intersection.keys():
96 # Each field had one common item 76 # Each field had one common item
97 self.assertEqual(len(intersection[key]), 1) 77 self.assertEqual(len(intersection[key]), 1)
98 for item in intersection[key]: 78 for item in intersection[key]:
99 for other_v_dict in v_dict_list: 79 for other_v_dict in v_dict_list:
100 self.assertNotIn(item, other_v_dict[key]) 80 self.assertNotIn(item, other_v_dict[key])
101 81
102 82
103 def main(): 83 def main():
104 loader = unittest.TestLoader() 84 loader = unittest.TestLoader()
105 suite = loader.loadTestsFromTestCase(VarsDictTest) 85 suite = loader.loadTestsFromTestCase(VarsDictTest)
106 unittest.TextTestRunner(verbosity=2).run(suite) 86 unittest.TextTestRunner(verbosity=2).run(suite)
107 87
108 if __name__ == "__main__": 88 if __name__ == "__main__":
109 main() 89 main()
110 90
OLDNEW
« no previous file with comments | « platform_tools/android/tests/utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698