public void TestByte()
		{
			TestByte( 0 );
			TestByte( ( Byte )1 );
			TestByte( Byte.MinValue );
			TestByte( Byte.MaxValue );
			var sw = Stopwatch.StartNew();
			var rand = new TestRandom();
			for ( int i = 0; i < 1000; i++ )
			{
				TestByte( rand.NextByte() );
			}
			sw.Stop();
			Debug.WriteLine( "Byte: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0 );
		}
Esempio n. 2
0
        public void TestUInt64()
        {
            TestUInt64(0);
            TestUInt64(( UInt64 )1);
            TestUInt64(UInt64.MinValue);
            TestUInt64(UInt64.MaxValue);
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();

            for (int i = 0; i < 1000; i++)
            {
                TestUInt64(rand.NextUInt64());
            }
            sw.Stop();
            Debug.WriteLine("UInt64: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0);
        }
        public void TestByte()
        {
            TestByte(0);
            TestByte(( Byte )1);
            TestByte(Byte.MinValue);
            TestByte(Byte.MaxValue);
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();

            for (int i = 0; i < 1000; i++)
            {
                TestByte(rand.NextByte());
            }
            sw.Stop();
            Console.WriteLine("Byte: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0);
        }
Esempio n. 4
0
        public void TestInt16()
        {
            TestInt16(0);
            TestInt16(-1);
            TestInt16(( Int16 )1);
            TestInt16(Int16.MinValue);
            TestInt16(Int16.MaxValue);
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();

            for (int i = 0; i < 1000; i++)
            {
                TestInt16(rand.NextInt16());
            }
            sw.Stop();
            Debug.WriteLine("Int16: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0);
        }
		public void TestAsByte()
		{
			TestAsByte( 0 );
			TestAsByte( 127 );
			TestAsByte( 128 );
			TestAsByte( ( Byte )1 );
			TestAsByte( Byte.MinValue );
			TestAsByte( Byte.MaxValue );
			var sw = Stopwatch.StartNew();
			var rand = new TestRandom();
			for ( int i = 0; i < 100000; i++ )
			{
				TestAsByte( rand.NextByte() );
			}
			sw.Stop();
			Console.WriteLine( "Byte: {0:#,0.###} usec/object", sw.Elapsed.Ticks / 1000000.0 );
		}
        public void TestInt32()
        {
            TestInt32(0);
            TestInt32(-1);
            TestInt32(( Int32 )1);
            TestInt32(Int32.MinValue);
            TestInt32(Int32.MaxValue);
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();

            for (int i = 0; i < 1000; i++)
            {
                TestInt32(rand.NextInt32());
            }
            sw.Stop();
            Console.WriteLine("Int32: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0);
        }
Esempio n. 7
0
        public void TestAsUInt64()
        {
            TestAsUInt64(0);
            TestAsUInt64(127);
            TestAsUInt64(128);
            TestAsUInt64(( UInt64 )1);
            TestAsUInt64(UInt64.MinValue);
            TestAsUInt64(UInt64.MaxValue);
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();

            for (int i = 0; i < 100000; i++)
            {
                TestAsUInt64(rand.NextUInt64());
            }
            sw.Stop();
            Console.WriteLine("UInt64: {0:#,0.###} usec/object", sw.Elapsed.Ticks / 1000000.0);
        }
        public void TestAsByte()
        {
            TestAsByte(0);
            TestAsByte(127);
            TestAsByte(128);
            TestAsByte(( Byte )1);
            TestAsByte(Byte.MinValue);
            TestAsByte(Byte.MaxValue);

#if !SILVERLIGHT
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();
            for (int i = 0; i < 1000; i++)
            {
                TestAsByte(rand.NextByte());
            }
            sw.Stop();
            Console.WriteLine("Byte: {0:#,0.###} usec/object", GetMicroseconds(sw));
#endif // !SILVERLIGHT
        }
Esempio n. 9
0
        public void TestAsSByte()
        {
            TestAsSByte(0);
            TestAsSByte(127);
            TestAsSByte(-1);
            TestAsSByte(-31);
            TestAsSByte(-32);
            TestAsSByte(( SByte )1);
            TestAsSByte(SByte.MinValue);
            TestAsSByte(SByte.MaxValue);
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();

            for (int i = 0; i < 100000; i++)
            {
                TestAsSByte(rand.NextSByte());
            }
            sw.Stop();
            Console.WriteLine("SByte: {0:#,0.###} usec/object", sw.Elapsed.Ticks / 1000000.0);
        }
        public void TestDouble()
        {
            TestDouble(0.0);
            TestDouble(-0.0);
            TestDouble(1.0);
            TestDouble(-1.0);
            TestDouble(Double.MaxValue);
            TestDouble(Double.MinValue);
            TestDouble(Double.NaN);
            TestDouble(Double.NegativeInfinity);
            TestDouble(Double.PositiveInfinity);
            var        sw   = Stopwatch.StartNew();
            TestRandom rand = new TestRandom();

            for (int i = 0; i < 1000; i++)
            {
                TestDouble(rand.NextDouble());
            }
            sw.Stop();
            Console.WriteLine("Double: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0);
        }
Esempio n. 11
0
        public void TestAsInt32()
        {
            TestAsInt32(0);
            TestAsInt32(127);
            TestAsInt32(128);
            TestAsInt32(-1);
            TestAsInt32(-31);
            TestAsInt32(-32);
            TestAsInt32(( Int32 )1);
            TestAsInt32(Int32.MinValue);
            TestAsInt32(Int32.MaxValue);
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();

            for (int i = 0; i < 100000; i++)
            {
                TestAsInt32(rand.NextInt32());
            }
            sw.Stop();
            Console.WriteLine("Int32: {0:#,0.###} usec/object", sw.Elapsed.Ticks / 1000000.0);
        }
Esempio n. 12
0
        public void TestAsSingle()
        {
            TestAsSingle(0.0f);
            TestAsSingle(-0.0f);
            TestAsSingle(1.0f);
            TestAsSingle(-1.0f);
            TestAsSingle(Single.MaxValue);
            TestAsSingle(Single.MinValue);
            TestAsSingle(Single.NaN);
            TestAsSingle(Single.NegativeInfinity);
            TestAsSingle(Single.PositiveInfinity);
            var        sw   = Stopwatch.StartNew();
            TestRandom rand = new TestRandom();

            for (int i = 0; i < 100000; i++)
            {
                TestAsSingle(rand.NextSingle());
            }
            sw.Stop();
            Console.WriteLine("Single: {0:#,0.###} usec/object", sw.Elapsed.Ticks / 1000000.0);
        }
        public void TestAsDouble()
        {
            TestAsDouble(0.0);
            TestAsDouble(-0.0);
            TestAsDouble(1.0);
            TestAsDouble(-1.0);
            TestAsDouble(Double.MaxValue);
            TestAsDouble(Double.MinValue);
            TestAsDouble(Double.NaN);
            TestAsDouble(Double.NegativeInfinity);
            TestAsDouble(Double.PositiveInfinity);

#if !SILVERLIGHT
            var        sw   = Stopwatch.StartNew();
            TestRandom rand = new TestRandom();
            for (int i = 0; i < 1000; i++)
            {
                TestAsDouble(rand.NextDouble());
            }
            sw.Stop();
            Console.WriteLine("Double: {0:#,0.###} usec/object", GetMicroseconds(sw));
#endif // !SILVERLIGHT
        }
        public void TestAsInt64()
        {
            TestAsInt64(0);
            TestAsInt64(127);
            TestAsInt64(128);
            TestAsInt64(-1);
            TestAsInt64(-31);
            TestAsInt64(-32);
            TestAsInt64(( Int64 )1);
            TestAsInt64(Int64.MinValue);
            TestAsInt64(Int64.MaxValue);

#if !SILVERLIGHT
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();
            for (int i = 0; i < 1000; i++)
            {
                TestAsInt64(rand.NextInt64());
            }
            sw.Stop();
            Console.WriteLine("Int64: {0:#,0.###} usec/object", GetMicroseconds(sw));
#endif // !SILVERLIGHT
        }
		public void TestAsDouble()
		{
			TestAsDouble( 0.0 );
			TestAsDouble( -0.0 );
			TestAsDouble( 1.0 );
			TestAsDouble( -1.0 );
			TestAsDouble( Double.MaxValue );
			TestAsDouble( Double.MinValue );
			TestAsDouble( Double.NaN );
			TestAsDouble( Double.NegativeInfinity );
			TestAsDouble( Double.PositiveInfinity );
			var sw = Stopwatch.StartNew();
			TestRandom rand = new TestRandom();
			for ( int i = 0; i < 100000; i++ )
			{
				TestAsDouble( rand.NextDouble() );
			}
			sw.Stop();
			Console.WriteLine( "Double: {0:#,0.###} usec/object", sw.Elapsed.Ticks / 1000000.0 );
		}
		public void TestAsUInt64()
		{
			TestAsUInt64( 0 );
			TestAsUInt64( 127 );
			TestAsUInt64( 128 );
			TestAsUInt64( ( UInt64 )1 );
			TestAsUInt64( UInt64.MinValue );
			TestAsUInt64( UInt64.MaxValue );
			var sw = Stopwatch.StartNew();
			var rand = new TestRandom();
			for ( int i = 0; i < 100000; i++ )
			{
				TestAsUInt64( rand.NextUInt64() );
			}
			sw.Stop();
			Console.WriteLine( "UInt64: {0:#,0.###} usec/object", sw.Elapsed.Ticks / 1000000.0 );
		}
		public void TestAsInt32()
		{
			TestAsInt32( 0 );
			TestAsInt32( 127 );
			TestAsInt32( 128 );
			TestAsInt32( -1 );
			TestAsInt32( -31 );
			TestAsInt32( -32 );
			TestAsInt32( ( Int32 )1 );
			TestAsInt32( Int32.MinValue );
			TestAsInt32( Int32.MaxValue );
			var sw = Stopwatch.StartNew();
			var rand = new TestRandom();
			for ( int i = 0; i < 100000; i++ )
			{
				TestAsInt32( rand.NextInt32() );
			}
			sw.Stop();
			Console.WriteLine( "Int32: {0:#,0.###} usec/object", sw.Elapsed.Ticks / 1000000.0 );
		}
		public void TestInt16()
		{
			TestInt16( 0 );
			TestInt16( -1 );
			TestInt16( ( Int16 )1 );
			TestInt16( Int16.MinValue );
			TestInt16( Int16.MaxValue );
			var sw = Stopwatch.StartNew();
			var rand = new TestRandom();
			for ( int i = 0; i < 1000; i++ )
			{
				TestInt16( rand.NextInt16() );
			}
			sw.Stop();
			Debug.WriteLine( "Int16: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0 );
		}
Esempio n. 19
0
		public void TestUInt32()
		{
			TestUInt32( 0 );
			TestUInt32( ( UInt32 )1 );
			TestUInt32( UInt32.MinValue );
			TestUInt32( UInt32.MaxValue );
			var sw = Stopwatch.StartNew();
			var rand = new TestRandom();
			for ( int i = 0; i < 1000; i++ )
			{
				TestUInt32( rand.NextUInt32() );
			}
			sw.Stop();
			Console.WriteLine( "UInt32: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0 );
		}
		public void TestSingle()
		{
			TestSingle( 0.0f );
			TestSingle( -0.0f );
			TestSingle( 1.0f );
			TestSingle( -1.0f );
			TestSingle( Single.MaxValue );
			TestSingle( Single.MinValue );
			TestSingle( Single.NaN );
			TestSingle( Single.NegativeInfinity );
			TestSingle( Single.PositiveInfinity );
			var sw = Stopwatch.StartNew();
			TestRandom rand = new TestRandom();
			for ( int i = 0; i < 1000; i++ )
			{
				TestSingle( rand.NextSingle() );
			}
			sw.Stop();
			Debug.WriteLine( "Single: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0 );
		}
Esempio n. 21
0
		public void TestInt64()
		{
			TestInt64( 0 );
			TestInt64( -1 );
			TestInt64( ( Int64 )1 );
			TestInt64( Int64.MinValue );
			TestInt64( Int64.MaxValue );
			var sw = Stopwatch.StartNew();
			var rand = new TestRandom();
			for ( int i = 0; i < 1000; i++ )
			{
				TestInt64( rand.NextInt64() );
			}
			sw.Stop();
			Console.WriteLine( "Int64: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0 );
		}