diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2012-11-15 19:22:26 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-15 19:22:26 +0000 |
| commit | b9b5a5fc16e21387b3350260d2139b293bbcd2b0 (patch) | |
| tree | f7d7203af2efe8f41bbeeb8fcdd649c4ec3390c0 /cs-dotnet/src/tests | |
| parent | f1e413e914b9f03607194757848bab1ed4f401a3 (diff) | |
| download | libgats-b9b5a5fc16e21387b3350260d2139b293bbcd2b0.tar.gz libgats-b9b5a5fc16e21387b3350260d2139b293bbcd2b0.tar.bz2 libgats-b9b5a5fc16e21387b3350260d2139b293bbcd2b0.tar.xz libgats-b9b5a5fc16e21387b3350260d2139b293bbcd2b0.zip | |
Much overriding was done, but GatsList works great. And just like a standard
.net list.
Diffstat (limited to 'cs-dotnet/src/tests')
| -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 | } | ||
