diff options
Diffstat (limited to '')
-rw-r--r-- | cs-dotnet/src/tests/floats.cs | 39 |
1 files changed, 39 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 @@ | |||
1 | using System; | ||
2 | using System.IO; | ||
3 | using Com.Xagasoft.Gats; | ||
4 | |||
5 | public 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 | } | ||