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();
            Console.WriteLine("Int16: {0:0.###} msec/object", sw.ElapsedMilliseconds / 1000.0);
        }
示例#2
0
        public void TestAsInt16()
        {
            TestAsInt16(0);
            TestAsInt16(127);
            TestAsInt16(128);
            TestAsInt16(-1);
            TestAsInt16(-31);
            TestAsInt16(-32);
            TestAsInt16(( Int16 )1);
            TestAsInt16(Int16.MinValue);
            TestAsInt16(Int16.MaxValue);
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();

            for (int i = 0; i < 100000; i++)
            {
                TestAsInt16(rand.NextInt16());
            }
            sw.Stop();
            Console.WriteLine("Int16: {0:#,0.###} usec/object", sw.Elapsed.Ticks / 1000000.0);
        }
        public void TestAsInt16()
        {
            TestAsInt16(0);
            TestAsInt16(127);
            TestAsInt16(128);
            TestAsInt16(-1);
            TestAsInt16(-31);
            TestAsInt16(-32);
            TestAsInt16(( Int16 )1);
            TestAsInt16(Int16.MinValue);
            TestAsInt16(Int16.MaxValue);

#if !SILVERLIGHT
            var sw   = Stopwatch.StartNew();
            var rand = new TestRandom();
            for (int i = 0; i < 1000; i++)
            {
                TestAsInt16(rand.NextInt16());
            }
            sw.Stop();
            Console.WriteLine("Int16: {0:#,0.###} usec/object", GetMicroseconds(sw));
#endif // !SILVERLIGHT
        }
		public void TestAsInt16()
		{
			TestAsInt16( 0 );
			TestAsInt16( 127 );
			TestAsInt16( 128 );
			TestAsInt16( -1 );
			TestAsInt16( -31 );
			TestAsInt16( -32 );
			TestAsInt16( ( Int16 )1 );
			TestAsInt16( Int16.MinValue );
			TestAsInt16( Int16.MaxValue );
			var sw = Stopwatch.StartNew();
			var rand = new TestRandom();
			for ( int i = 0; i < 100000; i++ )
			{
				TestAsInt16( rand.NextInt16() );
			}
			sw.Stop();
			Console.WriteLine( "Int16: {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 );
		}