예제 #1
0
        // POPULATE_VALUES
        //
        private void PopulateValues()
        {
            if (!isULong)
            {
                // generate numbers
                long[] edges8  = NumberGenerator.GenerateBadNumbers(8, n);
                long[] edges16 = NumberGenerator.GenerateBadNumbers(16, n);
                long[] edges24 = NumberGenerator.GenerateBadNumbers(24, n);
                long[] edges32 = NumberGenerator.GenerateBadNumbers(32, n);
                long[] edges64 = NumberGenerator.GenerateBadNumbers(64, n);

                values[8]  = edges8;
                values[16] = edges16;
                values[24] = edges24;
                values[32] = edges32;
                values[64] = edges64;

                // setup values
                List <long> listVals = new List <long>();

                for (int i = 0; i < values[size].Length; ++i)
                {
                    if (signed)
                    {
                        if (values[size][i] >= minValue && values[size][i] <= (long)maxValue)
                        {
                            listVals.Add(values[size][i]);
                        }
                    }
                    else
                    {
                        if (values[size][i] >= minValue && (ulong)values[size][i] <= maxValue)
                        {
                            listVals.Add(values[size][i]);
                        }
                    }
                }

                values[size] = listVals.ToArray();
            }
            else
            {
                ulong[] uEdges64 = NumberGenerator.GenerateBadPositiveUInt64(n);
                ulongValues = uEdges64;

                List <ulong> listUVals = new List <ulong>();
                for (int i = 0; i < ulongValues.Length; ++i)
                {
                    if (ulongValues[i] >= 0 && ulongValues[i] <= maxValue)
                    {
                        listUVals.Add(ulongValues[i]);
                    }
                }

                ulongValues = listUVals.ToArray();
            }
        }