Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
falfaddaghi committed Jul 20, 2019
1 parent 3e7b66d commit ebe24ac
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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

[<TestFixture>]
module ``Basic Grammar Element Constraints`` =

[<Test>]
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 = ()
"""

[<Test>]
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")


[<Test>]
let ``float 32``() =
let pi = 3.14_15F
Assert.AreEqual(3.1415F,pi,"Wrong parsing")

1 change: 1 addition & 0 deletions tests/fsharp/FSharpSuite.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<Compile Include="tests.fs" />
<Compile Include="Compiler\ILChecker.fs" />
<Compile Include="Compiler\CompilerAssert.fs" />
<Compile Include="Compiler\Conformance\BasicGrammarElements\BasicConstrants.fs" />
<Compile Include="Compiler\ErrorMessages\ConstructorTests.fs" />
<Compile Include="Compiler\ErrorMessages\AccessOfTypeAbbreviationTests.fs" />
<Compile Include="Compiler\ErrorMessages\ElseBranchHasWrongTypeTests.fs" />
Expand Down

0 comments on commit ebe24ac

Please sign in to comment.