public void MainTest()
        {
            const string netCoreApp2expected =
                @"4.2 != 4.2000002861023
4.2 != 4.20000028610229
(float)4.2M != 4.2F
4.20000028610229 != 4.2
4.2F != 4.2D
4.19999980926514 != 4.2
4.2F != 4.2D";

            string expected =
                @"4.2 != 4.2000002861023
4.2 != 4.200000286102295
(float)4.2M != 4.2000003F
4.200000286102295 != 4.2
4.2000003F != 4.2D
4.199999809265137 != 4.2
4.2F != 4.2D";

            string netCoreVersion = NetCore.GetNetCoreVersion();

            if (string.Compare(netCoreVersion, "3") < 0)
            {
                expected = netCoreApp2expected;
            }

            IntelliTect.TestTools.Console.ConsoleAssert.Expect(
                expected, Program.Main);
        }
        public void Main_WriteNumbers()
        {
            const string netCoreApp2expected =
                @"42
1.618034
1.61803398874989
1.618033988749895
6.023E+23
42
0x2A";

            string expected = // netcoreapp3.0 and later
                              @"42
1.618034
1.618033988749895
1.618033988749895
6.023E+23
42
0x2A";

            string netCoreVersion = NetCore.GetNetCoreVersion();

            if (string.Compare(netCoreVersion, "3") < 0)
            {
                expected = netCoreApp2expected;
            }

            IntelliTect.TestTools.Console.ConsoleAssert.Expect(
                expected, Program.Main);
        }
        public void Main_Listing02_09()
        {
            const string netCoreApp2expected =
                @"1.61803398974989 == 1.61803398974989:False
1.61803398974989 == 1.61803398974989:True";

            string expected = // netcoreapp3.0 and later
                              @"1.618033988749895 == 1.618033988749895:True
1.618033988749895 == 1.618033988749895:True";

            string netCoreVersion = NetCore.GetNetCoreVersion();

            if (string.Compare(netCoreVersion, "3") < 0)
            {
                expected = netCoreApp2expected;
            }
            IntelliTect.TestTools.Console.ConsoleAssert.Expect(
                expected, Chapter02.数据类型.Listing02_09.Listing02_09.Main);
        }
Beispiel #4
0
        public void Main_WriteBooleanStatements()
        {
            const string netCoreApp2expected =
                @"False: 1.61803398874989 == 1.61803398874989
True: 1.61803398874989 == 1.61803398874989";

            string expected = // netcoreapp3.0 and later
                              @"True: 1.618033988749895 == 1.618033988749895
True: 1.618033988749895 == 1.618033988749895";

            string netCoreVersion = NetCore.GetNetCoreVersion();

            if (string.Compare(netCoreVersion, "3") < 0)
            {
                expected = netCoreApp2expected;
            }

            IntelliTect.TestTools.Console.ConsoleAssert.Expect(
                expected, Program.Main);
        }