Skip to content

Commit c5ebf4f

Browse files
committed
Add tests for Float80, but only on the desktop; which is tricky, since Gyb doesn't know its destination.
Now 3835 tests. Reviewed by Dmitri. Swift SVN r24237
1 parent 9970d78 commit c5ebf4f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

utils/SwiftIntTypes.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@ def all_integer_type_names():
7878
return [self_ty.stdlib_name for self_ty in all_integer_types(0)]
7979

8080
def all_real_number_type_names():
81-
return ['Float', 'Double'] #TODO Float80 for i386 & x86_64
81+
return ['Float', 'Double', 'Float80'] # Float80 for i386 & x86_64
8282

8383
def all_numeric_type_names():
8484
return all_integer_type_names() + all_real_number_type_names()
8585

86+
def numeric_type_names_Macintosh_only():
87+
return ['Float80']
88+
8689
# Swift_Programming_Language/Expressions.html
8790

8891
def all_integer_binary_operator_names():

validation-test/stdlib/NumericDiagnostics.swift.gyb

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// RUN: rm -rf %t && mkdir -p %t && %S/../../utils/gyb %s -o %t/main.swift
22
// RUN: %S/../../utils/line-directive %t/main.swift -- %target-build-swift -parse -Xfrontend -verify %t/main.swift
33

4-
% from SwiftIntTypes import all_numeric_type_names, all_integer_type_names, \
5-
% all_integer_binary_operator_names, all_integer_or_real_binary_operator_names, \
4+
% from SwiftIntTypes import all_numeric_type_names, numeric_type_names_Macintosh_only, \
5+
% all_integer_type_names,all_integer_binary_operator_names, all_integer_or_real_binary_operator_names, \
66
% all_arithmetic_comparison_operator_names, all_integer_assignment_operator_names, \
77
% all_integer_or_real_assignment_operator_names
88

99
% int_ops = all_integer_binary_operator_names() + all_integer_assignment_operator_names()
1010
% arith_ops = all_integer_or_real_binary_operator_names() + \
1111
% all_arithmetic_comparison_operator_names() + all_integer_or_real_assignment_operator_names()
1212

13-
//TODO: Better error regex, verify the type of the result, Float80 for i386 & x86_64
13+
//TODO: Verify the type of the result
1414

1515
func testIteratedOperations() {
1616
% for typesToTest, operatorsToTest in zip([all_integer_type_names(), all_numeric_type_names()], \
@@ -20,13 +20,17 @@ func testIteratedOperations() {
2020
// typesToTest: ${typesToTest}, operatorsToTest: ${operatorsToTest}
2121
% for T1 in typesToTest:
2222
% for T2 in typesToTest:
23+
${ "\n\n#if arch(i386) || arch(x86_64)\n" if T1 in numeric_type_names_Macintosh_only()
24+
or T2 in numeric_type_names_Macintosh_only() else "" }
2325
% for op in operatorsToTest:
2426
if true {
2527
var x1_${T1}: ${T1} = 0
2628
var x2_${T2}: ${T2} = 0
2729
x1_${T1} ${op} x2_${T2} ${ "// expected-error{{ }}" if T1 != T2 else "" }
2830
}
2931
%end
32+
${ "\n#endif //arch(i386) || arch(x86_64)\n\n" if T1 in numeric_type_names_Macintosh_only()
33+
or T2 in numeric_type_names_Macintosh_only() else "" }
3034
%end
3135
%end
3236
%end

0 commit comments

Comments
 (0)