comparison tango/tango/io/protocol/PickleProtocol.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children
comparison
equal deleted inserted replaced
131:5825d48b27d1 132:1700239cab2e
1 /*******************************************************************************
2
3 copyright: Copyright (c) 2007 Kris Bell. All rights reserved
4
5 license: BSD style: $(LICENSE)
6
7 version: Jan 2007 : initial release
8
9 author: Kris
10
11 *******************************************************************************/
12
13 module tango.io.protocol.PickleProtocol;
14
15 /*******************************************************************************
16
17 *******************************************************************************/
18
19 version (BigEndian)
20 {
21 private import tango.io.protocol.NativeProtocol;
22 public alias NativeProtocol PickleProtocol;
23 }
24 else
25 {
26 private import tango.io.protocol.EndianProtocol;
27 public alias EndianProtocol PickleProtocol;
28 }
29
30
31 /*******************************************************************************
32
33 *******************************************************************************/
34
35 debug (UnitTest)
36 {
37 import tango.io.Buffer;
38
39 unittest
40 {
41 int test = 0xcc55ff00;
42
43 auto protocol = new PickleProtocol (new Buffer(32));
44 protocol.write (&test, test.sizeof, protocol.Type.Int);
45
46 auto ptr = protocol.buffer.slice (test.sizeof, false).ptr;
47 protocol.read (&test, test.sizeof, protocol.Type.Int);
48
49 assert (test == 0xcc55ff00);
50
51 version (LittleEndian)
52 assert (*cast(int*) ptr == 0x00ff55cc);
53 }
54 }
55
56
57
58
59