diff options
author | Marek Safar <marek.safar@gmail.com> | 2008-12-19 18:02:59 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2008-12-19 18:02:59 +0300 |
commit | a57ea8054f9aa8d23cc011720f32a36321d97b0c (patch) | |
tree | eb94a4bc1301aa2f499310c4790b591028d22742 /mcs/tests/gtest-397.cs | |
parent | 3c666ed0337fc5bbbbb5ec6322826573d5509297 (diff) |
Set svn:eol-style
svn path=/trunk/mcs/; revision=121849
Diffstat (limited to 'mcs/tests/gtest-397.cs')
-rw-r--r-- | mcs/tests/gtest-397.cs | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/mcs/tests/gtest-397.cs b/mcs/tests/gtest-397.cs index a899a717c1b..a3478f6cb3e 100644 --- a/mcs/tests/gtest-397.cs +++ b/mcs/tests/gtest-397.cs @@ -1,79 +1,79 @@ -using System;
-
-struct Foo
-{
- public int Value;
-
- public Foo (int value)
- {
- this.Value = value;
- }
-
- public static Foo operator - (Foo? f)
- {
- if (f.HasValue)
- return new Foo (-f.Value.Value);
-
- return new Foo (42);
- }
-}
-
-struct Bar
-{
- public int Value;
-
- public Bar (int value)
- {
- this.Value = value;
- }
-
- public static Bar? operator - (Bar? b)
- {
- if (b.HasValue)
- return new Bar (-b.Value.Value);
-
- return b;
- }
-}
-
-class Test
-{
-
- static Foo NegateFoo (Foo f)
- {
- return -f;
- }
-
- static Foo NegateFooNullable (Foo? f)
- {
- return -f;
- }
-
- static Bar? NegateBarNullable (Bar? b)
- {
- return -b;
- }
-
- static Bar? NegateBar (Bar b)
- {
- return -b;
- }
-
- static int Main ()
- {
- if (NegateFooNullable (null).Value != 42)
- return 1;
-
- if (NegateFoo (new Foo (2)).Value != -2)
- return 2;
-
- if (NegateBarNullable (null) != null)
- return 3;
-
- if (NegateBar (new Bar (2)).Value.Value != -2)
- return 4;
-
- Console.WriteLine ("OK");
- return 0;
- }
-}
+using System; + +struct Foo +{ + public int Value; + + public Foo (int value) + { + this.Value = value; + } + + public static Foo operator - (Foo? f) + { + if (f.HasValue) + return new Foo (-f.Value.Value); + + return new Foo (42); + } +} + +struct Bar +{ + public int Value; + + public Bar (int value) + { + this.Value = value; + } + + public static Bar? operator - (Bar? b) + { + if (b.HasValue) + return new Bar (-b.Value.Value); + + return b; + } +} + +class Test +{ + + static Foo NegateFoo (Foo f) + { + return -f; + } + + static Foo NegateFooNullable (Foo? f) + { + return -f; + } + + static Bar? NegateBarNullable (Bar? b) + { + return -b; + } + + static Bar? NegateBar (Bar b) + { + return -b; + } + + static int Main () + { + if (NegateFooNullable (null).Value != 42) + return 1; + + if (NegateFoo (new Foo (2)).Value != -2) + return 2; + + if (NegateBarNullable (null) != null) + return 3; + + if (NegateBar (new Bar (2)).Value.Value != -2) + return 4; + + Console.WriteLine ("OK"); + return 0; + } +} |