-
Notifications
You must be signed in to change notification settings - Fork 796
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e7b66d
commit ebe24ac
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstrants.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters