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. 2
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 TestAsInt32()
        {
            TestAsInt32(0);
            TestAsInt32(127);
            TestAsInt32(128);
            TestAsInt32(-1);
            TestAsInt32(-31);
            TestAsInt32(-32);
            TestAsInt32(( Int32 )1);
            TestAsInt32(Int32.MinValue);
            TestAsInt32(Int32.MaxValue);

#if !SILVERLIGHT
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();
            for (int i = 0; i < 1000; i++)
            {
                TestAsInt32(rand.NextInt32());
            }
            sw.Stop();
            Console.WriteLine("Int32: {0:#,0.###} usec/object", GetMicroseconds(sw));
#endif // !SILVERLIGHT
        }
		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 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();
			Debug.WriteLine( "Int32: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0 );
		}