using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics;
namespace SampleApplication { public class RequiresException : Exception { public RequiresException(string message) { } } public class EnsuresException : Exception { public EnsuresException(string message) { } } public class InvariantException : Exception { public InvariantException(string message) { } } public class AssertException : Exception { public AssertException(string message) { } } public class AssumeException : Exception { public AssumeException(string message) { } } public static class CustomRewiterMethods {
public static void Requires(bool cond, string msg) { if (!cond) throw new RequiresException(msg); } public static void Ensures(bool cond, string msg) { if (!cond) throw new EnsuresException(msg); } public static void Assert(bool cond, string msg) { if (!cond) throw new AssertException(msg); } public static void Assume(bool cond, string msg) { if (!cond) throw new AssumeException(msg); } public static void Invariant(bool cond, string msg) { if (!cond) throw new InvariantException(msg); } } }
|