| OLD | NEW |
| (Empty) |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import unittest | |
| 6 | |
| 7 import module as mojom | |
| 8 import generator | |
| 9 | |
| 10 class TestGenerator(unittest.TestCase): | |
| 11 | |
| 12 def testGetUnionsAddsOrdinals(self): | |
| 13 module = mojom.Module() | |
| 14 union = module.AddUnion('a') | |
| 15 union.AddField('a', mojom.BOOL) | |
| 16 union.AddField('b', mojom.BOOL) | |
| 17 union.AddField('c', mojom.BOOL, ordinal=10) | |
| 18 union.AddField('d', mojom.BOOL) | |
| 19 | |
| 20 gen = generator.Generator(module) | |
| 21 union = gen.GetUnions()[0] | |
| 22 ordinals = [field.ordinal for field in union.fields] | |
| 23 | |
| 24 self.assertEquals([0, 1, 10, 11], ordinals) | |
| OLD | NEW |