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

// Void.cs: Represents OCL testing for the OclVoid 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 OclVoid expressions

       class VoidTests

       {

             

              OCL

              [

                     "context VoidTests::_v1 : Boolean"

                     "init: OclVoid.oclIsUndefined()"

              ]

              private bool _v1;

             

              OCL

              [

                     "context VoidTests::_v2 : Boolean"

                     "init: OclVoid = OclVoid"

              ]

              private bool _v2;

             

              OCL

              [

                     "context VoidTests::_v3 : Boolean"

                     "init: OclVoid = 1"

              ]

              private bool _v3;

             

              OCL

              [

                     "context VoidTests::_v4 : Boolean"

                     "init: OclVoid <> OclVoid"

              ]

              private bool _v4;

             

              OCL

              [

                     "context VoidTests::_v5 : Boolean"

                     "init: OclVoid <> 1"

              ]

              private bool _v5;

             

              OCL

              [

                     "context VoidTests::_v2a : Boolean"

                     "init: OclVoid.=(OclVoid)"

              ]

              private bool _v2a;

             

              OCL

              [

                     "context VoidTests::_v3a : Boolean"

                     "init: OclVoid.=(1)"

              ]

              private bool _v3a;

             

              OCL

              [

                     "context VoidTests::_v4a : Boolean"

                     "init: OclVoid.<>(OclVoid)"

              ]

              private bool _v4a;

             

              OCL

              [

                     "context VoidTests::_v5a : Boolean"

                     "init: OclVoid.<>(1)"

              ]

              private bool _v5a;

             

             

              OCL

              [

                     "context VoidTests::_v6 : Boolean"

                     "init: 1 = OclVoid"

              ]

              private bool _v6;

             

              OCL

              [

                     "context VoidTests::_v7 : ArrayList"

                     "init: OclVoid"

              ]

              private ArrayList _v7;

             

              OCL

              [

                     "context VoidTests::_v8 : Boolean"

                     "init: true or OclVoid"

              ]

              private bool _v8;

             

              OCL

              [

                     "context VoidTests::_v9 : Boolean"

                     "init: OclVoid or true"

              ]

              private bool _v9;

             

              OCL

              [

                     "context VoidTests::_v10 : Boolean"

                     "init: false and OclVoid"

              ]

              private bool _v10;

             

              OCL

              [

                     "context VoidTests::_v11 : Boolean"

                     "init: OclVoid and false"

              ]

              private bool _v11;

             

              OCL

              [

                     "context VoidTests::_v12 : Boolean"

                     "init: false implies OclVoid"

              ]

              private bool _v12;

             

             

             

             

             

              public void RunTests()

              {

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

                     Console.WriteLine("V1 (OclVoid.oclIsUndefined(): {0}", _v1);

                     Console.WriteLine("V2 (OclVoid = OclVoid): {0}", _v2);

                     Console.WriteLine("V3 (OclVoid = 1): {0}", _v3);

                     Console.WriteLine("V4 (OclVoid <> OclVoid): {0}", _v4);

                     Console.WriteLine("V5 (OclVoid <> 1): {0}", _v5);

                     Console.WriteLine("V2A (OclVoid.=(OclVoid)): {0}", _v2a);

                     Console.WriteLine("V3A (OclVoid.=(1)): {0}", _v3a);

                     Console.WriteLine("V4A (OclVoid.<>(OclVoid)): {0}", _v4a);

                     Console.WriteLine("V5A (OclVoid.<>(1)): {0}", _v5a);

                     Console.WriteLine("V6 (1 = OclVoid): {0}", _v6);

                     if(_v7 == null)

                           Console.WriteLine("V7 (OclVoid): null");

                     else

                           Console.WriteLine("V7 (OclVoid): <NOT NULL>");

                     Console.WriteLine("V8 (true or OclVoid): {0}", _v8);

                     Console.WriteLine("V9 (OclVoid or true): {0}", _v9);

                     Console.WriteLine("V10 (false and OclVoid): {0}", _v10);

                     Console.WriteLine("V11 (OclVoid and false): {0}", _v11);

                     Console.WriteLine("V12 (false implies OclVoid): {0}", _v12);

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

              }

       }

}

 

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

// EOF