Exemple #1
0
        internal Value(System.Boolean value, Parameterization p = Parameterization.Value)
            : base(value)
        {
            Original  = value;
            _clrType  = typeof(System.Boolean);
            _hashCode = GetCrossTypeHashCode(_clrType, value.GetHashCode());

            Build = (buildContext, buildArgs) =>
            {
                return((p != Parameterization.None) ? (value.Parameterize(buildContext, p) ??
                                                       Mapping.BuildCast(value)) : Mapping.BuildCast(value));
            };
        }
Exemple #2
0
        static StackObject *GetHashCode_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Boolean instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack);

            var result_of_this_method = instance_of_this_method.GetHashCode();

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method;
            return(__ret + 1);
        }
 public bool runTest()
   {
   Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
   int iCountErrors = 0;
   int iCountTestcases = 0;
   String strLoc = "Loc_000oo";
   short[] in2Arr = new Int16[10];
   int[] in4Arr = new Int32[5];
   Boolean[] boArr = new Boolean[3];
   int iHashCode1, iHashCode2;
   try {
   do
     {
     strLoc = "Loc_01hc";
     iCountTestcases++;
     in2Arr = new Int16[10];
     iHashCode1 = in2Arr.GetHashCode();
     iHashCode2 = in2Arr.GetHashCode();
     if(iHashCode1 != iHashCode2)
       {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ ", Err_01hc! , Array.GetHashCode on a same instance twice result different value." );
       }
     strLoc = "Loc_02hc";
     iCountTestcases++;
     in4Arr = new Int32[5];
     iHashCode1 = in2Arr.GetHashCode();
     iHashCode2 = in4Arr.GetHashCode();
     if(iHashCode1 == iHashCode2)
       {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ ", Err_02hc! , Array.GetHashCode on a different array type instances result same value." );
       }
     boArr = new Boolean[3];
     strLoc = "Loc_03hc";
     iCountTestcases++;
     iHashCode1 = in2Arr.GetHashCode();
     iHashCode2 = boArr.GetHashCode();
     if(iHashCode1 == iHashCode2)
       {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ ", Err_03hc! , Array.GetHashCode on a different array type instances result same value." );
       }
     strLoc = "Loc_04hc";
     iCountTestcases++;
     Array Arr1 = Array.CreateInstance(typeof(double), 10);
     Array Arr2 = Array.CreateInstance(typeof(Single), 0);
     iHashCode1 = Arr1.GetHashCode();
     iHashCode2 = Arr2.GetHashCode();
     if( iHashCode1 == iHashCode2 )
       {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ ", Err_04hc! , Array.GetHashCode on a different array type instances result same value." );
       }
     int[][] i4Arr = new int[3][];
     i4Arr[0] = new int[] {1, 2, 3};
     i4Arr[1] = new int[] {1, 2, 3, 4, 5, 6};
     i4Arr[2] = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
     strLoc = "Loc_05hc";
     iCountTestcases++;
     iHashCode1 = i4Arr.GetHashCode();
     iHashCode2 = i4Arr.GetHashCode();
     if( iHashCode1 != iHashCode2 )
       {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ ", Err_05hc! , Array.GetHashCode on a same instance of jagged array should result same value." );
       }
     strLoc = "Loc_06hc";
     iCountTestcases++;
     string[,,,,,] strArr = new string[6,5,4,3,2,1];
     iHashCode2 = strArr.GetHashCode();
     if( iHashCode1 == iHashCode2 )
       {
       iCountErrors++;
       Console.WriteLine( s_strTFAbbrev+ ", Err_06hc! , Array.GetHashCode on a different array type instances result same value." );
       }
     } while (false);
   } catch (Exception exc_general ) {
   ++iCountErrors;
   Console.WriteLine(s_strTFAbbrev +", Error Err_8888yyy!  strLoc=="+ strLoc +", exc_general=="+exc_general);
   }
   if ( iCountErrors == 0 )
     {
     Console.Error.WriteLine( "paSs.   "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases);
     return true;
     }
   else
     {
     Console.Error.WriteLine("FAiL!   "+s_strTFPath+" "+s_strTFName+" ,inCountErrors=="+iCountErrors+" , BugNums?: "+s_strActiveBugNums );
     return false;
     }
   }