@@ -51,60 +51,30 @@ function test_expr(f, supertype::Type = Integer)
5151end
5252
5353@testset " no invalidations test set" begin
54+ int_types = (Bool, Int8, UInt8, Int16, UInt16, Int, UInt, BigInt)
5455 @testset " construction of old int types from new type" begin
55- @test test_expr (n -> :(Base. Bool (:: $n ) = false ))
56- @test test_expr (n -> :(Base. Int8 (:: $n ) = Int8 (0 ))) broken= true
57- @test test_expr (n -> :(Base. UInt8 (:: $n ) = UInt8 (0 ))) broken= true
58- @test test_expr (n -> :(Base. Int16 (:: $n ) = Int16 (0 )))
59- @test test_expr (n -> :(Base. UInt16 (:: $n ) = UInt16 (0 ))) broken= true
60- @test test_expr (n -> :(Base. Int (:: $n ) = 0 )) broken= true
61- @test test_expr (n -> :(Base. UInt (:: $n ) = 0x0 )) broken= true
56+ broken = (Int8, UInt8, UInt16, Int, UInt)
57+ @testset " T: $T " for T ∈ int_types
58+ @test test_expr (n -> :(Base.$ T (:: $n ) = $ T (0 ))) broken= (T ∈ broken)
59+ end
6260 end
6361 @testset " arithmetic between old int types and new int type" begin
64- @test test_expr (n -> :(Base.:(+ )(:: $n , m:: Bool ) = m))
65- @test test_expr (n -> :(Base.:(+ )(m:: Bool , :: $n ) = m))
66- @test test_expr (n -> :(Base.:(+ )(:: $n , m:: Int8 ) = m))
67- @test test_expr (n -> :(Base.:(+ )(m:: Int8 , :: $n ) = m))
68- @test test_expr (n -> :(Base.:(+ )(:: $n , m:: UInt8 ) = m))
69- @test test_expr (n -> :(Base.:(+ )(m:: UInt8 , :: $n ) = m))
70- @test test_expr (n -> :(Base.:(+ )(:: $n , m:: Int16 ) = m))
71- @test test_expr (n -> :(Base.:(+ )(m:: Int16 , :: $n ) = m))
72- @test test_expr (n -> :(Base.:(+ )(:: $n , m:: UInt16 ) = m))
73- @test test_expr (n -> :(Base.:(+ )(m:: UInt16 , :: $n ) = m))
74- @test test_expr (n -> :(Base.:(+ )(:: $n , m:: Int ) = m))
75- @test test_expr (n -> :(Base.:(+ )(m:: Int , :: $n ) = m)) broken= true
76- @test test_expr (n -> :(Base.:(+ )(:: $n , m:: UInt ) = m))
77- @test test_expr (n -> :(Base.:(+ )(m:: UInt , :: $n ) = m))
62+ broken = (Int,)
63+ @testset " T: $T " for T ∈ int_types
64+ @test (
65+ test_expr (n -> :(Base.:(+ )(:: $n , m:: $T ) = m)) &&
66+ test_expr (n -> :(Base.:(+ )(m:: $T , :: $n ) = m))
67+ ) broken= (T ∈ broken)
68+ end
7869 end
7970 @testset " promotion between old int types and new int type" begin
80- @test (
81- test_expr (n -> :(Base. promote_rule (:: Type{Bool} , :: Type{$n} ) = Bool)) &&
82- test_expr (n -> :(Base. promote_rule (:: Type{$n} , :: Type{Bool} ) = Bool))
83- ) broken= true
84- @test (
85- test_expr (n -> :(Base. promote_rule (:: Type{Int8} , :: Type{$n} ) = Int8)) &&
86- test_expr (n -> :(Base. promote_rule (:: Type{$n} , :: Type{Int8} ) = Int8))
87- )
88- @test (
89- test_expr (n -> :(Base. promote_rule (:: Type{UInt8} , :: Type{$n} ) = UInt8)) &&
90- test_expr (n -> :(Base. promote_rule (:: Type{$n} , :: Type{UInt8} ) = UInt8))
91- ) broken= true
92- @test (
93- test_expr (n -> :(Base. promote_rule (:: Type{Int16} , :: Type{$n} ) = Int16)) &&
94- test_expr (n -> :(Base. promote_rule (:: Type{$n} , :: Type{Int16} ) = Int16))
95- )
96- @test (
97- test_expr (n -> :(Base. promote_rule (:: Type{UInt16} , :: Type{$n} ) = UInt16)) &&
98- test_expr (n -> :(Base. promote_rule (:: Type{$n} , :: Type{UInt16} ) = UInt16))
99- )
100- @test (
101- test_expr (n -> :(Base. promote_rule (:: Type{Int} , :: Type{$n} ) = Int)) &&
102- test_expr (n -> :(Base. promote_rule (:: Type{$n} , :: Type{Int} ) = Int))
103- ) broken= true
104- @test (
105- test_expr (n -> :(Base. promote_rule (:: Type{UInt} , :: Type{$n} ) = UInt)) &&
106- test_expr (n -> :(Base. promote_rule (:: Type{$n} , :: Type{UInt} ) = UInt))
107- )
71+ broken = (Bool, UInt8, Int)
72+ @testset " T: $T " for T ∈ int_types
73+ @test (
74+ test_expr (n -> :(Base. promote_rule (:: Type{$T} , :: Type{$n} ) = $ T)) &&
75+ test_expr (n -> :(Base. promote_rule (:: Type{$n} , :: Type{$T} ) = $ T))
76+ ) broken= (T ∈ broken)
77+ end
10878 end
10979 @testset " unary functions" begin
11080 @test test_expr (n -> :(Base. zero (:: $n ) = $ n ())) broken= true
0 commit comments