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

// Enum.cs: Represents OCL testing for the Enumeration STL type

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

// 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 Enumeration expressions

       class EnumerationTests

       {

              // The enumeration we will use for testing

              private enum EN

              {

                     One,

                    

                     Two,

                    

                     Three,

                    

                     Four

              }

              OCL

              [

                     "context EnumerationTests::_e1 : Boolean"

                     "init: EN::One = EN::One"

              ]

              private bool _e1;

             

              OCL

              [

                     "context EnumerationTests::_e2 : Boolean"

                     "init: EN::One = EN::Two"

              ]

              private bool _e2;

             

              OCL

              [

                     "context EnumerationTests::_e3 : Boolean"

                     "init: EN::Three <> EN::Three"

              ]

              private bool _e3;

             

              OCL

              [

                     "context EnumerationTests::_e4 : Boolean"

                     "init: EN::Three <> EN::Four"

              ]

              private bool _e4;

             

              OCL

              [

                     "context EnumerationTests::_e1a : Boolean"

                     "init: EN::One.=(EN::One)"

              ]

              private bool _e1a;

             

              OCL

              [

                     "context EnumerationTests::_e2a : Boolean"

                     "init: EN::One.=(EN::Two)"

              ]

              private bool _e2a;

             

              OCL

              [

                     "context EnumerationTests::_e3a : Boolean"

                     "init: EN::Three.<>(EN::Three)"

              ]

              private bool _e3a;

             

              OCL

              [

                     "context EnumerationTests::_e4a : Boolean"

                     "init: EN::Three.<>(EN::Four)"

              ]

              private bool _e4a;

             

              OCL

              [

                     "context EnumerationTests::_e5 : EN"

                     "init: EN::Three"

              ]

              private EN _e5;

             

             

             

             

              public void RunTests()

              {

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

                     Console.WriteLine("E1 (EN::One = EN::One): {0}", _e1);

                     Console.WriteLine("E2 (EN::One = EN::Two): {0}", _e2);

                     Console.WriteLine("E3 (EN::Three <> EN::Three): {0}", _e3);

                     Console.WriteLine("E4 (EN::Three <> EN::Four): {0}", _e4);

                     Console.WriteLine("E1A (EN::One.=(EN::One)): {0}", _e1a);

                     Console.WriteLine("E2A (EN::One.=(EN::Two)): {0}", _e2a);

                     Console.WriteLine("E3A (EN::Three.<>(EN::Three)): {0}", _e3a);

                     Console.WriteLine("E4A (EN::Three.<>(EN::Four)): {0}", _e4a);

                     Console.WriteLine("E5  (EN::Three): {0}", _e5);

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

              }

       }

}

 

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

// EOF