aboutsummaryrefslogtreecommitdiff
path: root/cs-dotnet/src/tests
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-15 17:41:14 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-15 17:41:14 +0000
commitf1e413e914b9f03607194757848bab1ed4f401a3 (patch)
tree0cc0dbba61295b47bf343d439a4234123c4369a3 /cs-dotnet/src/tests
parent63628550708a616c5c58bc5c707db1e7fd9cd7c2 (diff)
downloadlibgats-f1e413e914b9f03607194757848bab1ed4f401a3.tar.gz
libgats-f1e413e914b9f03607194757848bab1ed4f401a3.tar.bz2
libgats-f1e413e914b9f03607194757848bab1ed4f401a3.tar.xz
libgats-f1e413e914b9f03607194757848bab1ed4f401a3.zip
Accidentally included a dll, oops. Also, gats null, and gats float work
correctly now and are tested against the python implementation.
Diffstat (limited to '')
-rw-r--r--cs-dotnet/src/tests/floats.cs39
-rw-r--r--cs-dotnet/src/tests/ints.cs3
2 files changed, 42 insertions, 0 deletions
diff --git a/cs-dotnet/src/tests/floats.cs b/cs-dotnet/src/tests/floats.cs
new file mode 100644
index 0000000..b64402c
--- /dev/null
+++ b/cs-dotnet/src/tests/floats.cs
@@ -0,0 +1,39 @@
1using System;
2using System.IO;
3using Com.Xagasoft.Gats;
4
5public class Test
6{
7 public static void Write( double d, Stream s )
8 {
9 GatsFloat gf = new GatsFloat( d );
10 gf.Write( s );
11 Console.WriteLine("Wrote: " + d );
12 }
13
14 public static void Read( Stream s )
15 {
16 GatsObject o = GatsObject.Read( s );
17 Console.WriteLine("Read type: " + o.GetType() );
18 Console.WriteLine("Read vlaue: " + o );
19 }
20
21 public static void Main()
22 {
23 MemoryStream ms = new MemoryStream();
24 Write( Math.PI, ms );
25 ms.Seek( 0, SeekOrigin.Begin );
26 Read( ms );
27
28 try
29 {
30 FileStream fs = new FileStream("float.gats", FileMode.Open,
31 FileAccess.Read );
32 Read( fs );
33 }
34 catch( Exception e )
35 {
36 Console.WriteLine("Can't test files: " + e.Message );
37 }
38 }
39}
diff --git a/cs-dotnet/src/tests/ints.cs b/cs-dotnet/src/tests/ints.cs
index 7099995..766b667 100644
--- a/cs-dotnet/src/tests/ints.cs
+++ b/cs-dotnet/src/tests/ints.cs
@@ -1,4 +1,5 @@
1using System; 1using System;
2using System.Globalization;
2using System.IO; 3using System.IO;
3using Com.Xagasoft.Gats; 4using Com.Xagasoft.Gats;
4 5
@@ -11,5 +12,7 @@ class Ints
11 GatsObject obj = GatsObject.Read( file ); 12 GatsObject obj = GatsObject.Read( file );
12 Console.WriteLine("Read type: " + obj.GetType() ); 13 Console.WriteLine("Read type: " + obj.GetType() );
13 Console.WriteLine("Read int: " + ((GatsInteger)obj).Value ); 14 Console.WriteLine("Read int: " + ((GatsInteger)obj).Value );
15
16 Console.WriteLine("Float? " + double.Parse("0x1.62e42fefa39efp+2") );
14 } 17 }
15} 18}