| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 '''Unit tests for grit.format.data_pack''' | 6 '''Unit tests for grit.format.data_pack''' |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 if __name__ == '__main__': | 10 if __name__ == '__main__': |
| 11 sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../..')) | 11 sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../..')) |
| 12 import unittest | 12 import unittest |
| 13 | 13 |
| 14 from grit.format import data_pack | 14 from grit.format import data_pack |
| 15 | 15 |
| 16 class FormatDataPackUnittest(unittest.TestCase): | 16 class FormatDataPackUnittest(unittest.TestCase): |
| 17 def testWriteDataPack(self): | 17 def testWriteDataPack(self): |
| 18 expected = ('\x01\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x008\x00\x00' | 18 expected = ('\x02\x00\x00\x00\x04\x00\x00\x00\x01\x000\x00\x00' |
| 19 '\x00\x00\x00\x00\x00\x04\x00\x00\x008\x00\x00\x00\x0c\x00\x00\x00' | 19 '\x00\x00\x00\x00\x00\x04\x000\x00\x00\x00\x0c\x00\x00\x00' |
| 20 '\x06\x00\x00\x00D\x00\x00\x00\x0c\x00\x00\x00\n\x00\x00\x00P\x00' | 20 '\x06\x00<\x00\x00\x00\x0c\x00\x00\x00\n\x00H\x00' |
| 21 '\x00\x00\x00\x00\x00\x00this is id 4this is id 6') | 21 '\x00\x00\x00\x00\x00\x00this is id 4this is id 6') |
| 22 input = { 1: "", 4: "this is id 4", 6: "this is id 6", 10: "" } | 22 input = { 1: "", 4: "this is id 4", 6: "this is id 6", 10: "" } |
| 23 output = data_pack.DataPack.WriteDataPack(input) | 23 output = data_pack.DataPack.WriteDataPack(input) |
| 24 self.failUnless(output == expected) | 24 self.failUnless(output == expected) |
| 25 | 25 |
| 26 | 26 |
| 27 if __name__ == '__main__': | 27 if __name__ == '__main__': |
| 28 unittest.main() | 28 unittest.main() |
| 29 | 29 |
| OLD | NEW |