Skip to content

Commit 5d13d2a

Browse files
authored
Merge pull request #3985 from apple/stdlib-int-stride-tests
stdlib: add tests for Stride types on integers
2 parents 32f2c99 + ee773c7 commit 5d13d2a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

validation-test/stdlib/FixedPoint.swift.gyb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var FixedPoint = TestSuite("FixedPoint")
99
%{
1010

1111
import gyb
12+
from SwiftIntTypes import all_integer_types
1213

1314
test_bit_patterns = [
1415
0x0000000000000000,
@@ -61,6 +62,32 @@ def get_fixed_point_hash(bit_pattern, src_bits, word_bits):
6162

6263
}%
6364

65+
//===----------------------------------------------------------------------===//
66+
// 'Int.Stride' type
67+
//===----------------------------------------------------------------------===//
68+
69+
FixedPoint.test("Integers.Stride") {
70+
#if arch(i386) || arch(arm)
71+
72+
% for self_ty in all_integer_types(32):
73+
% Self = self_ty.stdlib_name
74+
expectEqualType(Int.self, ${Self}.Stride.self)
75+
% end
76+
77+
#elseif arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)
78+
79+
% for self_ty in all_integer_types(64):
80+
% Self = self_ty.stdlib_name
81+
expectEqualType(Int.self, ${Self}.Stride.self)
82+
% end
83+
84+
#else
85+
86+
_UnimplementedError()
87+
88+
#endif
89+
}
90+
6491
//===----------------------------------------------------------------------===//
6592
// 'Int(truncatingBitPattern:)' initializer
6693
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)