File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -387,5 +387,35 @@ UnsafeMutablePointerTestSuite.test("customPlaygroundQuickLook") {
387
387
}
388
388
}
389
389
390
- runAllTests()
390
+ % for (SelfName, SelfType) in [
391
+ % ('UnsafePointer', 'UnsafePointer<Int>'),
392
+ % ('UnsafeMutablePointer', 'UnsafeMutablePointer<Int>')]:
393
+
394
+ ${SelfName}TestSuite.test("Comparable") {
395
+ var addresses: [UInt] = [
396
+ 0x00000001,
397
+ 0xFF00FF00,
398
+ 0x00001111,
399
+ 0x00000002,
400
+ 0xFFFFFFFF,
401
+ 0x00001111
402
+ ]
403
+
404
+ #if arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le)
405
+ addresses += [
406
+ 0xFFFFFFFF80000000,
407
+ 0x8000000000000000
408
+ ]
409
+ #endif
410
+
411
+ let instances = addresses.map { ($0, ${SelfType}(bitPattern: $0)!) }
391
412
413
+ func comparisonOracle(i: Int, j: Int) -> ExpectedComparisonResult {
414
+ return instances[i].0 <=> instances[j].0
415
+ }
416
+ checkComparable(instances.map { $0.1 }, oracle: comparisonOracle)
417
+ }
418
+
419
+ % end
420
+
421
+ runAllTests()
You can’t perform that action at this time.
0 commit comments