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

// Let.cs: Represents OCL testing for Let expressions

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

// 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 the Let expressions

       class LetTests

       {

      

              OCL

              [

                     "context LetTests::Square2() : Integer"

                     "post: let Value : Integer = 2 in result = Value * Value"

                    

              ]

              public int Square2()

              {

                     return 2 * 2;

              }

             

              OCL

              [

                     "context LetTests::Square(i : Integer) : Integer"

                     "pre: let PV : Integer = 2 in i > PV"

                     "post: let PV : Integer = i in result = PV * PV"

              ]

              public int Square(int i)

              {

                     return i*i;

              }

 

             

              public void RunTests()

              {

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

                     Console.WriteLine("L1 (Square2()): {0}", Square2());

                     Console.WriteLine("L2 (Square(4)): {0}", Square(4));

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

              }

       }

}

 

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

// EOF