-
-
Notifications
You must be signed in to change notification settings - Fork 179
Open
Description
PSKoans/PSKoans/Koans/Introduction/AboutNumbers.Koans.ps1
Lines 94 to 99 in 1317701
| $BigValue | Should -BeOfType [long] | |
| $BigValue | Should -BeGreaterThan $MaxValue | |
| $SmallValue = __ | |
| $SmallValue | Should -BeOfType [long] | |
| $SmallValue | Should -BeLessThan $MinValue |
Is this part correct about numbers getting converted to longs?
Because no matter, what I try for me it's always a double
Code:
$BigValue = [int]::MaxValue + 200
$BigValue | Should -BeOfType [long]
$BigValue | Should -BeGreaterThan $MaxValueOutput:
Expected the value to have type [long] or any of its subtypes, but got 2147483847 with type [double].
Starting with a short and increasing it to >MaxValue behaves the same:
~\PSKoans
❯ $int = [int]::MaxValue
~\PSKoans
❯ $int.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Int32 System.ValueType
~\PSKoans
❯ $int += 100
~\PSKoans
❯ $int.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Double System.ValueTypeMetadata
Metadata
Assignees
Labels
No labels