summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sam Blackshear <unknown>2011-05-24 14:39:29 +0530
committerGravatar Sam Blackshear <unknown>2011-05-24 14:39:29 +0530
commit5cfbcc0fed2cc711ddcd6702ebd821cff95103ab (patch)
treee128ff66e6c2369fb10744f2b6dada911fc550e5
parent746c28cd03e8840e8525352ff2aebcfeb76ca2a1 (diff)
New example to demonstrate exception support that would be convenient for Boogie.
-rw-r--r--BCT/Samples/Exceptions/ExceptionsExample.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/BCT/Samples/Exceptions/ExceptionsExample.cs b/BCT/Samples/Exceptions/ExceptionsExample.cs
new file mode 100644
index 00000000..176d0339
--- /dev/null
+++ b/BCT/Samples/Exceptions/ExceptionsExample.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Threading;
+using System.Collections.Generic;
+using System.Diagnostics.Contracts;
+using System.Linq;
+using System.Text;
+
+/* Simple example of exception support needed by Poirot */
+
+class PoirotMain
+{
+
+ public static void foo()
+ {
+ throw new Exception("Error");
+ }
+
+ public static void Main()
+ {
+ int x = 5;
+ try
+ {
+ foo();
+ x = 17;
+ }
+ catch (Exception e)
+ {
+ x = 34;
+ }
+ Contract.Assert(x == 34);
+ }
+}
+
+
+