diff options
author | Tim Peters <tim.peters@gmail.com> | 2006-04-16 22:11:28 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2006-04-16 22:11:28 (GMT) |
commit | c5c9ce957de4bd5de944bf30efe742e561761ecd (patch) | |
tree | 6f9c0d063ab59dedc54c80e4c14540b13501dd0d | |
parent | 715a4cdea2275d8a64f4556c45f89908ce5a0de6 (diff) | |
download | cpython-c5c9ce957de4bd5de944bf30efe742e561761ecd.zip cpython-c5c9ce957de4bd5de944bf30efe742e561761ecd.tar.gz cpython-c5c9ce957de4bd5de944bf30efe742e561761ecd.tar.bz2 |
Add missing SVN eol-style property to text files.
-rw-r--r-- | Lib/ctypes/test/test_unaligned_structures.py | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/Lib/ctypes/test/test_unaligned_structures.py b/Lib/ctypes/test/test_unaligned_structures.py index ffbc2be..89343ba 100644 --- a/Lib/ctypes/test/test_unaligned_structures.py +++ b/Lib/ctypes/test/test_unaligned_structures.py @@ -1,45 +1,45 @@ -import sys, unittest
-from ctypes import *
-
-structures = []
-byteswapped_structures = []
-
-
-if sys.byteorder == "little":
- SwappedStructure = BigEndianStructure
-else:
- SwappedStructure = LittleEndianStructure
-
-for typ in [c_short, c_int, c_long, c_longlong,
- c_float, c_double,
- c_ushort, c_uint, c_ulong, c_ulonglong]:
- class X(Structure):
- _pack_ = 1
- _fields_ = [("pad", c_byte),
- ("value", typ)]
- class Y(SwappedStructure):
- _pack_ = 1
- _fields_ = [("pad", c_byte),
- ("value", typ)]
- structures.append(X)
- byteswapped_structures.append(Y)
-
-class TestStructures(unittest.TestCase):
- def test_native(self):
- for typ in structures:
-## print typ.value
- self.failUnlessEqual(typ.value.offset, 1)
- o = typ()
- o.value = 4
- self.failUnlessEqual(o.value, 4)
-
- def test_swapped(self):
- for typ in byteswapped_structures:
-## print >> sys.stderr, typ.value
- self.failUnlessEqual(typ.value.offset, 1)
- o = typ()
- o.value = 4
- self.failUnlessEqual(o.value, 4)
-
-if __name__ == '__main__':
- unittest.main()
+import sys, unittest +from ctypes import * + +structures = [] +byteswapped_structures = [] + + +if sys.byteorder == "little": + SwappedStructure = BigEndianStructure +else: + SwappedStructure = LittleEndianStructure + +for typ in [c_short, c_int, c_long, c_longlong, + c_float, c_double, + c_ushort, c_uint, c_ulong, c_ulonglong]: + class X(Structure): + _pack_ = 1 + _fields_ = [("pad", c_byte), + ("value", typ)] + class Y(SwappedStructure): + _pack_ = 1 + _fields_ = [("pad", c_byte), + ("value", typ)] + structures.append(X) + byteswapped_structures.append(Y) + +class TestStructures(unittest.TestCase): + def test_native(self): + for typ in structures: +## print typ.value + self.failUnlessEqual(typ.value.offset, 1) + o = typ() + o.value = 4 + self.failUnlessEqual(o.value, 4) + + def test_swapped(self): + for typ in byteswapped_structures: +## print >> sys.stderr, typ.value + self.failUnlessEqual(typ.value.offset, 1) + o = typ() + o.value = 4 + self.failUnlessEqual(o.value, 4) + +if __name__ == '__main__': + unittest.main() |