Skip to content

Commit def2bb3

Browse files
committed
Replace all ~ calls with ! in test/.
1 parent 8a74321 commit def2bb3

File tree

8 files changed

+43
-46
lines changed

8 files changed

+43
-46
lines changed

test/bigint.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ end
181181
@test BigInt(-5) << -1 == -3
182182
end
183183
@testset "boolean ops" begin
184-
@test ~BigInt(123) == -124
184+
@test !BigInt(123) == -124
185185
@test BigInt(123) & BigInt(234) == 106
186186
@test BigInt(123) | BigInt(234) == 251
187187
@test BigInt(123) BigInt(234) == 145

test/bitarray.jl

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,6 @@ timesofar("dequeue")
742742

743743
@testset "Unary operators" begin
744744
b1 = bitrand(n1, n2)
745-
@check_bit_operation broadcast(~, b1) BitMatrix
746745
@check_bit_operation broadcast(!, b1) BitMatrix
747746
@check_bit_operation (-)(b1) Matrix{Int}
748747
@check_bit_operation broadcast(sign, b1) BitMatrix
@@ -751,15 +750,14 @@ timesofar("dequeue")
751750
@check_bit_operation conj(b1) BitMatrix
752751

753752
b0 = falses(0)
754-
@check_bit_operation broadcast(~, b0) BitVector
755753
@check_bit_operation broadcast(!, b0) BitVector
756754
@check_bit_operation (-)(b0) Vector{Int}
757755
@check_bit_operation broadcast(sign, b0) BitVector
758756

759757
@testset "flipbits!" begin
760758
b1 = bitrand(n1, n2)
761759
i1 = Array(b1)
762-
@test flipbits!(b1) == .~i1
760+
@test flipbits!(b1) == .!i1
763761
@test bitcheck(b1)
764762
end
765763
end
@@ -1095,13 +1093,13 @@ timesofar("datamove")
10951093
b1 = trues(v1)
10961094
for i = 0:(v1-1)
10971095
@test findfirst(b1 >> i) == i+1
1098-
@test Base.findfirstnot(.~(b1 >> i)) == i+1
1096+
@test Base.findfirstnot(.!(b1 >> i)) == i+1
10991097
end
11001098

11011099
for i = 3:(v1-1), j = 2:i
11021100
submask = b1 << (v1-j+1)
11031101
@test findnext((b1 >> i) .| submask, j) == i+1
1104-
@test findnextnot((.~(b1 >> i)) .⊻ submask, j) == i+1
1102+
@test findnextnot((.!(b1 >> i)) .⊻ submask, j) == i+1
11051103
end
11061104

11071105
b1 = bitrand(n1, n2)
@@ -1140,7 +1138,7 @@ timesofar("nnz&find")
11401138
for c = [falses, trues]
11411139
b1 = c(n)
11421140
b1[elts] = .!b1[elts]
1143-
b2 = .~b1
1141+
b2 = .!b1
11441142
i1 = Array(b1)
11451143
for i = 1:n
11461144
@test findprev(b1, i) == findprev(i1, i) == findprevnot(b2, i) == findprev(!, b2, i)
@@ -1151,7 +1149,7 @@ timesofar("nnz&find")
11511149
b1 = falses(1000)
11521150
b1[77] = true
11531151
b1[777] = true
1154-
b2 = .~b1
1152+
b2 = .!b1
11551153
@test_throws BoundsError findprev(b1, 1001)
11561154
@test_throws BoundsError findprevnot(b2, 1001)
11571155
@test_throws BoundsError findprev(!, b2, 1001)
@@ -1207,13 +1205,13 @@ timesofar("nnz&find")
12071205
@test findprev(t, l) == findprevnot(f, l) == l
12081206
b1 = falses(l)
12091207
b1[end] = true
1210-
b2 = .~b1
1208+
b2 = .!b1
12111209
@test findprev(b1, l) == findprevnot(b2, l) == l
12121210
@test findprevnot(b1, l) == findprev(b2, l) == l-1
12131211
if l > 1
12141212
b1 = falses(l)
12151213
b1[end-1] = true
1216-
b2 = .~b1
1214+
b2 = .!b1
12171215
@test findprev(b1, l) == findprevnot(b2, l) == l-1
12181216
@test findprevnot(b1, l) == findprev(b2, l) == l
12191217
end
@@ -1246,7 +1244,7 @@ timesofar("reductions")
12461244
for l = [0, 1, 63, 64, 65, 127, 128, 129, 255, 256, 257, 6399, 6400, 6401]
12471245
b1 = bitrand(l)
12481246
b2 = bitrand(l)
1249-
@test map(~, b1) == map(x->~x, b1) == broadcast(~, b1)
1247+
@test map(!, b1) == map(x->!x, b1) == broadcast(!, b1)
12501248
@test map(identity, b1) == map(x->x, b1) == b1
12511249

12521250
@test map(&, b1, b2) == map((x,y)->x&y, b1, b2) == broadcast(&, b1, b2)
@@ -1268,8 +1266,7 @@ timesofar("reductions")
12681266

12691267
@testset "map! for length $l" begin
12701268
b = BitVector(uninitialized, l)
1271-
@test map!(~, b, b1) == map!(x->~x, b, b1) == broadcast(~, b1) == b
1272-
@test map!(!, b, b1) == map!(x->!x, b, b1) == broadcast(~, b1) == b
1269+
@test map!(!, b, b1) == map!(x->!x, b, b1) == broadcast(!, b1) == b
12731270
@test map!(identity, b, b1) == map!(x->x, b, b1) == b1 == b
12741271
@test map!(zero, b, b1) == map!(x->false, b, b1) == falses(l) == b
12751272
@test map!(one, b, b1) == map!(x->true, b, b1) == trues(l) == b
@@ -1298,7 +1295,7 @@ timesofar("reductions")
12981295
B17970 = map(x -> x ? 1 : 2, A17970)
12991296
@test B17970::Array{Int,1} == [2,1,2]
13001297
C17970 = map(x -> x ? false : true, A17970)
1301-
@test C17970::BitArray{1} == map(~, A17970)
1298+
@test C17970::BitArray{1} == map(!, A17970)
13021299
end
13031300
end
13041301

test/core.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ let
567567
end
568568

569569
# tricky space sensitive syntax cases
570-
@test [-1 ~1] == [(-1) (~1)]
570+
@test [-1 !1] == [(-1) (!1)]
571571

572572
# undefinedness
573573
mutable struct UndefField

test/int.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ end
102102
@test mod(123, UInt8) == 0x7b
103103

104104
primitive type MyBitsType <: Integer 8 end
105-
@test_throws MethodError ~reinterpret(MyBitsType, 0x7b)
105+
@test_throws MethodError !reinterpret(MyBitsType, 0x7b)
106106

107107
UItypes = Base.BitUnsigned_types
108108
SItypes = Base.BitSigned_types

test/numbers.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const ≣ = isequal # convenient for comparing NaNs
1919
@test true != false
2020
@test false != true
2121

22-
@test ~true == false
23-
@test ~false == true
22+
@test !true == false
23+
@test !false == true
2424

2525
@test false & false == false
2626
@test true & false == false
@@ -2081,9 +2081,9 @@ end
20812081
@test signif(Float16(1.1), 70) === Float16(1.1)
20822082
end
20832083
@testset "issue #1308" begin
2084-
@test hex(~UInt128(0)) == "f"^32
2085-
@test (~0)%UInt128 == ~UInt128(0)
2086-
@test Int128(~0) == ~Int128(0)
2084+
@test hex(!UInt128(0)) == "f"^32
2085+
@test (!0)%UInt128 == !UInt128(0)
2086+
@test Int128(!0) == !Int128(0)
20872087
end
20882088
@testset "issue 1552" begin
20892089
@test isa(rationalize(Int8, float(pi)), Rational{Int8})
@@ -2311,7 +2311,7 @@ end
23112311
@testset "ispow2" begin
23122312
@test ispow2(64)
23132313
@test !ispow2(42)
2314-
@test !ispow2(~typemax(Int))
2314+
@test !ispow2(!typemax(Int))
23152315
end
23162316
@testset "nextpow/prevpow" begin
23172317
@test nextpow(2,1) == 1
@@ -2900,8 +2900,8 @@ end
29002900

29012901
let types = (Base.BitInteger_types..., BigInt, Bool)
29022902
for S in types
2903-
T = @inferred Base.promote_op(~, S)
2904-
t = @inferred ~one(S)
2903+
T = @inferred Base.promote_op(!, S)
2904+
t = @inferred !one(S)
29052905
@test T === typeof(t)
29062906

29072907
for R in types

test/ranges.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ end
10561056
@test size(similar(r, size(r))) == size(similar(r, length(r)))
10571057
end
10581058
end
1059-
@testset "sign, conj, ~ (Issue #16067)" begin
1059+
@testset "sign, conj, ! (Issue #16067)" begin
10601060
A = -1:1
10611061
B = -1.0:1.0
10621062
@test sign.(A) == [-1,0,1]
@@ -1067,8 +1067,8 @@ end
10671067
@test conj(A) === A
10681068
@test conj(B) === B
10691069

1070-
@test .~A == [0,-1,-2]
1071-
@test typeof(.~A) == Vector{Int}
1070+
@test .!A == [0,-1,-2]
1071+
@test typeof(.!A) == Vector{Int}
10721072
end
10731073

10741074
@testset "conversion to Array" begin

test/show.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ end
6868
@test_repr "2e"
6969
@test_repr "!x"
7070
@test_repr "f(1, 2, 3)"
71-
@test_repr "x = ~y"
71+
@test_repr "x = !y"
7272
@test_repr ":(:x, :y)"
7373
@test_repr ":(:(:(x)))"
7474

@@ -209,25 +209,25 @@ end"""
209209
# line meta
210210
if delta_kd == 0
211211
# line meta
212-
msk_d0 = ~(u << ld0) | (u << ld1 << 1)
212+
msk_d0 = !(u << ld0) | (u << ld1 << 1)
213213
else
214214
# line meta
215-
msk_d0 = ~(u << ld0)
215+
msk_d0 = !(u << ld0)
216216
# line meta
217217
msk_d1 = (u << ld1 << 1)
218218
end
219219
# line meta
220220
if delta_ks == 0
221221
# line meta
222-
msk_s0 = (u << ls0) & ~(u << ls1 << 1)
222+
msk_s0 = (u << ls0) & !(u << ls1 << 1)
223223
else
224224
# line meta
225225
msk_s0 = (u << ls0)
226226
end
227227
# line meta
228228
chunk_s0 = glue_src_bitchunks(src, ks0, ks1, msk_s0, ls0)
229229
# line meta
230-
dest[kd0] = (dest[kd0] & msk_d0) | ((chunk_s0 << ld0) & ~msk_d0)
230+
dest[kd0] = (dest[kd0] & msk_d0) | ((chunk_s0 << ld0) & !msk_d0)
231231
# line meta
232232
if delta_kd == 0
233233
# line meta
@@ -255,7 +255,7 @@ end"""
255255
# line meta
256256
chunk_s = (chunk_s0 >>> (63 - ld0) >>> 1) | (chunk_s1 << ld0)
257257
# line meta
258-
dest[kd1] = (dest[kd1] & msk_d1) | (chunk_s & ~msk_d1)
258+
dest[kd1] = (dest[kd1] & msk_d1) | (chunk_s & !msk_d1)
259259
# line meta
260260
return
261261
end"""
@@ -813,7 +813,7 @@ test_repr(":a.b")
813813
test_repr("a.:+")
814814
test_repr("(+).a")
815815
test_repr("(+).:-")
816-
test_repr("(!).:~")
816+
test_repr("(!).:-")
817817
test_repr("a.:(begin
818818
#= none:3 =#
819819
end)")

test/version.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,18 @@ end
103103
# issupbuild
104104
import Base.issupbuild
105105
@test issupbuild(v"4.3.2+")
106-
@test ~issupbuild(v"4.3.2")
107-
@test ~issupbuild(v"4.3.2-")
108-
@test ~issupbuild(v"4.3.2-a")
109-
@test ~issupbuild(v"4.3.2-a1")
110-
@test ~issupbuild(v"4.3.2-1")
111-
@test ~issupbuild(v"4.3.2-a.1")
112-
@test ~issupbuild(v"4.3.2-1a")
113-
@test ~issupbuild(v"4.3.2+a")
114-
@test ~issupbuild(v"4.3.2+a1")
115-
@test ~issupbuild(v"4.3.2+1")
116-
@test ~issupbuild(v"4.3.2+a.1")
117-
@test ~issupbuild(v"4.3.2+1a")
106+
@test !issupbuild(v"4.3.2")
107+
@test !issupbuild(v"4.3.2-")
108+
@test !issupbuild(v"4.3.2-a")
109+
@test !issupbuild(v"4.3.2-a1")
110+
@test !issupbuild(v"4.3.2-1")
111+
@test !issupbuild(v"4.3.2-a.1")
112+
@test !issupbuild(v"4.3.2-1a")
113+
@test !issupbuild(v"4.3.2+a")
114+
@test !issupbuild(v"4.3.2+a1")
115+
@test !issupbuild(v"4.3.2+1")
116+
@test !issupbuild(v"4.3.2+a.1")
117+
@test !issupbuild(v"4.3.2+1a")
118118

119119
# basic comparison
120120
VersionNumber(2, 3, 1) == VersionNumber(Int8(2), UInt32(3), Int32(1)) == v"2.3.1"

0 commit comments

Comments
 (0)