示例#1
0
文件: test-7.cs 项目: nobled/mono
		public static int Main ()
		{
			Blah k, l;

			k = new Blah (2) + new Blah (3);
			if (k.i != 5)
				return 1;
			
			k = ~ new Blah (5);
			if (k.i != -6)
				return 1;
			
			
			k = + new Blah (4);
			if (k.i != 4)
				return 1;
			
			k = - new Blah (21);
			if (k.i != -21)
				return 1;

			k = new Blah (22) - new Blah (21);
			if (k.i != 1)
				return 1;

			if (!k)
				Console.WriteLine ("! returned true");

			int number = k;
			if (number != 1)
				return 1;
			
			k++;	
			++k;

			if (k)
				Console.WriteLine ("k is definitely true");

			k = new Blah (30);

			double f = (double) k;

			if (f != 30.0)
				return 1;

			int i = new Blah (5) * new Blah (10);

			if (i != 50)
				return 1;

			k = new Blah (50);
			l = new Blah (10);
			
			i = k / l;

			if (i != 5)
				return 1;

			i = k % l;

			if (i != 0)
				return 1;

			MyBoolean myb = new MyBoolean ();

			if (!myb)
				return 10;

			//
			// Tests the conditional operator invoking operator true
			MyTrueFalse mf = new MyTrueFalse ();
			int x = mf ? 1 : 2;
			if (x != 1)
				return 11;
			
			Console.WriteLine ("Test passed");
			return 0;
		}
示例#2
0
        public static int Main()
        {
            Blah k, l;

            k = new Blah(2) + new Blah(3);
            if (k.i != 5)
            {
                return(1);
            }

            k = ~new Blah(5);
            if (k.i != -6)
            {
                return(1);
            }


            k = +new Blah(4);
            if (k.i != 4)
            {
                return(1);
            }

            k = -new Blah(21);
            if (k.i != -21)
            {
                return(1);
            }

            k = new Blah(22) - new Blah(21);
            if (k.i != 1)
            {
                return(1);
            }

            if (!k)
            {
                Console.WriteLine("! returned true");
            }

            int number = k;

            if (number != 1)
            {
                return(1);
            }

            k++;
            ++k;

            if (k)
            {
                Console.WriteLine("k is definitely true");
            }

            k = new Blah(30);

            double f = (double)k;

            if (f != 30.0)
            {
                return(1);
            }

            int i = new Blah(5) * new Blah(10);

            if (i != 50)
            {
                return(1);
            }

            k = new Blah(50);
            l = new Blah(10);

            i = k / l;

            if (i != 5)
            {
                return(1);
            }

            i = k % l;

            if (i != 0)
            {
                return(1);
            }

            MyBoolean myb = new MyBoolean();

            if (!myb)
            {
                return(10);
            }

            //
            // Tests the conditional operator invoking operator true
            MyTrueFalse mf = new MyTrueFalse();
            int         x  = mf ? 1 : 2;

            if (x != 1)
            {
                return(11);
            }

            Console.WriteLine("Test passed");
            return(0);
        }