-
Notifications
You must be signed in to change notification settings - Fork 830
Moved fsharpqa/Conformance/BasicGrammarElements/Constants test cases to NUnit #9626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c15b5c4
5e3f282
7c6296d
9c2d790
64591eb
dd19a4f
cf810f5
3eea677
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. | ||
|
|
||
| namespace FSharp.Compiler.UnitTests | ||
|
|
||
| open NUnit.Framework | ||
|
|
||
| [<TestFixture>] | ||
| module ``Char Constants`` = | ||
|
|
||
| [<TestCase('\a', 7 )>] // alert | ||
| [<TestCase('\b', 8 )>] // backspace | ||
| [<TestCase('\t', 9 )>] // horizontal tab | ||
| [<TestCase('\n', 10)>] // new line | ||
| [<TestCase('\v', 11)>] // vertical tab | ||
| [<TestCase('\f', 12)>] // form feed | ||
| [<TestCase('\r', 13)>] // return | ||
| [<TestCase('\"', 34)>] // double quote | ||
| [<TestCase('\'', 39)>] // single quote | ||
| [<TestCase('\\', 92)>] // backslash | ||
| let ``Escape characters`` character value = | ||
| Assert.areEqual character (char value) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. | ||
|
|
||
| namespace FSharp.Compiler.UnitTests | ||
|
|
||
| open NUnit.Framework | ||
|
|
||
| [<TestFixture>] | ||
| module ``Decimal Constants`` = | ||
|
|
||
| [<Test>] | ||
| let ``Product of decimal constants``() = | ||
| let oneOfOneMiDec = 1.0E-6M | ||
| let oneMiDec = 1.0E+6M | ||
|
|
||
| Assert.areEqual 1.0M (oneOfOneMiDec * oneMiDec) | ||
|
|
||
| [<Test>] | ||
| let ``Sum of decimal constants``() = | ||
| let x = | ||
| 1.0E0M | ||
| + 2.0E1M | ||
| + 3.0E2M | ||
| + 4.0E3M | ||
| + 5.0E4M | ||
| + 6.0E5M | ||
| + 7.0E6M | ||
| + 8.0E7M | ||
| + 9.0E8M | ||
| + 1.0E-1M | ||
| + 2.0E-2M | ||
| + 3.0E-3M | ||
| + 4.0E-4M | ||
| + 5.0E-5M | ||
| + 6.0E-6M | ||
| + 7.0E-7M | ||
| + 8.0E-8M | ||
| + 9.0E-9M | ||
|
|
||
| Assert.areEqual 987654321.123456789M x | ||
|
|
||
| [<Test>] | ||
| let ``Sum of decimal literals with leading zero in exponential``() = | ||
| let x = 1.0E00M + 2.0E01M + 3.E02M + 1.E-01M + 2.0E-02M | ||
|
|
||
| Assert.areEqual 321.12M x | ||
|
|
||
| [<Test>] | ||
| let ``Non-representable small values are rounded to zero``() = | ||
| // This test involves rounding of decimals. The F# design is to follow the BCL. | ||
| // This means that the behavior is not deterministic, e.g. Mono and NetFx4 round; NetFx2 gives an error | ||
| // This is a positive test on Dev10, at least until | ||
| // FSHARP1.0:4523 gets resolved. | ||
|
|
||
| Assert.areEqual 0.0M 1.0E-50M |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. | ||
|
|
||
| namespace FSharp.Compiler.UnitTests | ||
|
|
||
| open NUnit.Framework | ||
|
|
||
| [<TestFixture>] | ||
| module ``Integer Constants`` = | ||
|
|
||
| [<Test>] | ||
| let ``Operations with negative one``() = | ||
| // Verify the ability to specify negative numbers | ||
| // (And not get confused wrt subtraction.) | ||
|
|
||
| let x = -1 | ||
|
|
||
| Assert.areEqual -2 (x + x) | ||
| Assert.areEqual 0 (x - x) | ||
| Assert.areEqual 1 (x * x) | ||
| Assert.areEqual 1 (x / x) | ||
|
|
||
| [<Test>] | ||
| let ``Operations with negative integers``() = | ||
| // Verify the ability to specify negative numbers | ||
| // (And not get confused wrt subtraction.) | ||
|
|
||
| let fiveMinusSix = 5 - 6 | ||
| let fiveMinusSeven = 5-7 | ||
| let negativeSeven = -7 | ||
|
|
||
| Assert.areEqual -1 fiveMinusSix | ||
| Assert.areEqual -2 fiveMinusSeven | ||
| Assert.areEqual (-1 * 7) negativeSeven | ||
|
|
||
| [<Test>] | ||
| let ``Functions with negative integers``() = | ||
| // Verify the ability to specify negative numbers | ||
| // (And not get confused wrt subtraction.) | ||
|
|
||
| let ident x = x | ||
| let add x y = x + y | ||
|
|
||
| Assert.areEqual -10 (ident -10) | ||
| Assert.areEqual -10 (add -5 -5) |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is checking that an identifier that a literal that starts with a numeric is detected as invalid, and is a valid test case, why the change?
Thanks
Kevin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original test case for
1upgot merged as aInlineDatainto theTheoryabove, with other similar test cases from this migration.The
_52test case is from this migration (put it as separate, because it has a different behaviour, i.e. two error messages).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ThorstenReichert
sweet, thanks.