From ebe24ac3df564ebd83d7f27dc7b49c7009d6f3cc Mon Sep 17 00:00:00 2001 From: falfaddaghi Date: Sat, 20 Jul 2019 16:50:58 +0300 Subject: [PATCH] WIP --- .../BasicGrammarElements/BasicConstrants.fs | 66 +++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + 2 files changed, 67 insertions(+) create mode 100644 tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstrants.fs diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstrants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstrants.fs new file mode 100644 index 000000000000..a339b7215cfe --- /dev/null +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstrants.fs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Basic Grammar Element Constraints`` = + + [] + let `` Basic constraints compile `` () = + CompilerAssert.Pass + """ +let sbyteConst = 1y +let int16Const = 1us +let int32Const = 1ul +let int64Const = 1UL + +let byteConst = 1uy +let uint16Const = 1us +let uint32Const = 1ul +let uint64Const = 1uL + +let ieee32Const1 = 1.0f +let ieee32Const2 = 1.0F +let ieee32Const3 = 0x0000000000000001lf + +let ieee64Const1 = 1.0 +let ieee64Const2 = 0x0000000000000001LF + +let bigintConst = 1I + +// let bignumConst = 1N - you need a reference to PowerPack.dll now + +let decimalConst1 = 1.0M +let decimalConst2 = 1.0m + +let charConst = '1' + +let stringConst = "1" + +let bytestringConst = "1"B + +let bytecharConst = '1'B + +let boolConst1 = true +let boolConst2 = false + +let unitConst = () + """ + + [] + let ``int 64``() = + let creditCardNumber = 1234_5678_9012_3456L + let socialSecurityNumber = 999_99_9999L + + Assert.AreEqual(999999999L,socialSecurityNumber,"Wrong parsing") + Assert.AreEqual(1234567890123456L,creditCardNumber,"Wrong parsing") + + + [] + let ``float 32``() = + let pi = 3.14_15F + Assert.AreEqual(3.1415F,pi,"Wrong parsing") + diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 9d80400c4019..cae983065c83 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -32,6 +32,7 @@ +