Skip to content

Commit a501d25

Browse files
committed
Merge pull request #109 from SimonDanisch/sd/testcleanup
clean up tests
2 parents 5600969 + d795a8e commit a501d25

File tree

7 files changed

+95
-565
lines changed

7 files changed

+95
-565
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ os:
44
- osx
55
julia:
66
- 0.4
7+
- nightly
78
notifications:
89
email: false
910
script:
1011
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
11-
- julia --inline=no -e 'Pkg.clone(pwd()); Pkg.test("FixedSizeArrays"; coverage=true)'
12+
- julia -e 'Pkg.clone(pwd()); Pkg.test("FixedSizeArrays"; coverage=true)'
1213
after_success:
1314
- julia -e 'cd(Pkg.dir("FixedSizeArrays")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder()); Codecov.submit(process_folder())'

src/array_of_fixedsize.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ immutable ExtremaFun <: Functor{2} end
1313

1414
call(::MaxFun, a, b) = max(a, b)
1515
call(::MinFun, a, b) = min(a, b)
16+
call(::ExtremaFun, reducevalue, a) = min(reducevalue[1], a), max(reducevalue[2], a)
17+
1618
minimum{T <: FixedArray}(a::Vector{T}) = reduce(MinFun(), a)
1719
maximum{T <: FixedArray}(a::Vector{T}) = reduce(MaxFun(), a)
1820
extrema{T <: FixedArray}(a::AbstractVector{T}) = reduce(ExtremaFun(), a)

src/mapreduce.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ end
2020
red
2121
end
2222

23-
index_expr{T <: Number}(::Type{T}, i::Int, inds::Int...) = :($(symbol("arg$i")))
24-
index_expr{T <: FixedArray}(::Type{T}, i::Int, inds::Int...) = :($(symbol("arg$i"))[$(inds...)])
23+
index_expr{T <: Number}(::Type{T}, i::Int, inds::Int...) = :($(Symbol("arg$i")))
24+
index_expr{T <: FixedArray}(::Type{T}, i::Int, inds::Int...) = :($(Symbol("arg$i"))[$(inds...)])
2525
inner_expr{N}(args::NTuple{N, DataType}, inds::Int...) = :( F($(ntuple(i -> index_expr(args[i], i, inds...), N)...)) )
2626

2727

test/runtests.jl

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ immutable RGB{T} <: FixedVectorNoTuple{3, T}
1717
new{T}(a[1], a[2], a[3])
1818
end
1919
end
20+
# subtyping:
21+
immutable TestType{N,T} <: FixedVector{N,T}
22+
a::NTuple{N,T}
23+
end
24+
2025

2126
typealias Vec1d Vec{1, Float64}
2227
typealias Vec2d Vec{2, Float64}
@@ -37,6 +42,9 @@ end
3742

3843
facts("FixedSizeArrays") do
3944

45+
include("typeinf.jl")
46+
47+
4048
context("fsa macro") do
4149
a = 1
4250
a1 = @fsa([a,2,3])
@@ -141,6 +149,8 @@ context("Array of FixedArrays") do
141149

142150
@fact maximum(d) --> RGB(typemax(Float64))
143151
@fact minimum(d) --> RGB(typemin(Float64))
152+
153+
@fact extrema(c) --> (minimum(c), maximum(c))
144154
end
145155

146156
context("array ops") do
@@ -1050,13 +1060,6 @@ context("Base.Test") do
10501060
@fact Base.Test.@test_approx_eq(a, Vec(a)) --> nothing
10511061
end
10521062

1053-
end
1054-
1055-
# subtyping:
1056-
immutable TestType{N,T} <: FixedVector{N,T}
1057-
a::NTuple{N,T}
1058-
end
1059-
10601063
facts("show for subtype") do
10611064

10621065
Base.show(io::IO, x::TestType) = print(io, "$(x.a)") # show for new type
@@ -1065,6 +1068,13 @@ facts("show for subtype") do
10651068
@fact string(x) --> "(1,2)"
10661069
end
10671070

1071+
10681072
end
10691073

1074+
end
1075+
1076+
1077+
1078+
1079+
10701080
FactCheck.exitstatus()

test/speed_bench.jl

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)