File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -472,7 +472,7 @@ extension NSString {
472
472
473
473
public var longLongValue : Int64 {
474
474
get {
475
- NSUnimplemented ( )
475
+ return NSScanner ( string : _swiftObject ) . scanLongLong ( ) ?? 0
476
476
}
477
477
}
478
478
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ class TestNSString : XCTestCase {
36
36
( " test_FromNullTerminatedCStringInASCII " , test_FromNullTerminatedCStringInASCII ) ,
37
37
( " test_FromNullTerminatedCStringInUTF8 " , test_FromNullTerminatedCStringInUTF8 ) ,
38
38
( " test_FromMalformedNullTerminatedCStringInUTF8 " , test_FromMalformedNullTerminatedCStringInUTF8 ) ,
39
+ ( " test_longLongValue " , test_longLongValue ) ,
39
40
( " test_rangeOfCharacterFromSet " , test_rangeOfCharacterFromSet ) ,
40
41
]
41
42
}
@@ -182,6 +183,14 @@ class TestNSString : XCTestCase {
182
183
XCTAssertNil ( string)
183
184
}
184
185
186
+ func test_longLongValue( ) {
187
+ let string1 : NSString = " 9223372036854775808 "
188
+ XCTAssertEqual ( string1. longLongValue, 9223372036854775807 )
189
+
190
+ let string2 : NSString = " -9223372036854775809 "
191
+ XCTAssertEqual ( string2. longLongValue, - 9223372036854775808 )
192
+ }
193
+
185
194
func test_rangeOfCharacterFromSet( ) {
186
195
let string : NSString = " 0Az "
187
196
let letters = NSCharacterSet . letterCharacterSet ( )
You can’t perform that action at this time.
0 commit comments