diff options
Diffstat (limited to '')
-rw-r--r-- | cs-dotnet/src/tests/lists.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cs-dotnet/src/tests/lists.cs b/cs-dotnet/src/tests/lists.cs new file mode 100644 index 0000000..8d12bf9 --- /dev/null +++ b/cs-dotnet/src/tests/lists.cs | |||
@@ -0,0 +1,43 @@ | |||
1 | using System; | ||
2 | using System.IO; | ||
3 | using Com.Xagasoft.Gats; | ||
4 | |||
5 | public class Test | ||
6 | { | ||
7 | public static void Write( GatsObject o, Stream s ) | ||
8 | { | ||
9 | o.Write( s ); | ||
10 | Console.WriteLine("Wrote: " + o ); | ||
11 | } | ||
12 | |||
13 | public static void Read( Stream s ) | ||
14 | { | ||
15 | GatsObject o = GatsObject.Read( s ); | ||
16 | Console.WriteLine("Read type: " + o.GetType() ); | ||
17 | Console.WriteLine("Read vlaue: " + o ); | ||
18 | } | ||
19 | |||
20 | public static void Main() | ||
21 | { | ||
22 | MemoryStream ms = new MemoryStream(); | ||
23 | GatsList l = new GatsList(); | ||
24 | l.Add( new GatsFloat( Math.PI ) ); | ||
25 | l.Add( new GatsInteger( 1337 ) ); | ||
26 | l.Add( new GatsString("Hello") ); | ||
27 | Write( l, ms ); | ||
28 | ms.Seek( 0, SeekOrigin.Begin ); | ||
29 | Read( ms ); | ||
30 | /* | ||
31 | try | ||
32 | { | ||
33 | FileStream fs = new FileStream("float.gats", FileMode.Open, | ||
34 | FileAccess.Read ); | ||
35 | Read( fs ); | ||
36 | } | ||
37 | catch( Exception e ) | ||
38 | { | ||
39 | Console.WriteLine("Can't test files: " + e.Message ); | ||
40 | } | ||
41 | */ | ||
42 | } | ||
43 | } | ||