// ------------------------------------------------------------------

// Pre.cs: Represents OCL testing for Preconditions

// ------------------------------------------------------------------

// Project: C# and OCL Compiler

// Module:  Testing

// Author:  Dave Arnold

// Version: 1.0

// ------------------------------------------------------------------

 

// ------------------------------------------------------------------

// Imports

// ------------------------------------------------------------------

using System;

using System.Collections;

// ------------------------------------------------------------------

 

// ------------------------------------------------------------------

// DaveArnold.OCLTesting Namespace

// ------------------------------------------------------------------

namespace DaveArnold.OCLTesting

{

       // A Class to test Preconditions

       class PreTests

       {

              OCL

              [

                     "context PreTests::Square(a : Integer): Integer"

                     "pre: a > 0"

              ]

             

              OCL

              [

                     "context PreTests::Square(a : Integer): Integer"

                     "pre: a > 5"

              ]

             

              public int Square(int a)

              { return a*a;}

             

              public void RunTests()

              {

                     Console.WriteLine("---------------- PRE TESTS -----------------");

                     Console.WriteLine("P1 (Square(6)): {0}", Square(6));

                     Console.WriteLine("------------ PRE TESTS COMPLETE ------------");

              }

       }

}

 

// ------------------------------------------------------------------

// EOF