Skip to content

Commit

Permalink
added missing Furlong constructor and fix test typo
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Feb 8, 2017
1 parent c02ab74 commit fb913a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/dimensionful.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# represents a quantity in furlongs^p
immutable Furlong{p,T<:Number} <: Number
val::T
Furlong(v::Number) = new(v)
Furlong(x::Furlong{p}) = new(x.val)
end
Furlong{T<:Number}(x::T) = Furlong{1,T}(x)
(::Type{T}){p,T}(x::Furlong{p,T}) = x.val
Expand Down
2 changes: 1 addition & 1 deletion test/ranges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,6 @@ isdefined(Main, :TestHelpers) || @eval Main include("TestHelpers.jl")
using TestHelpers.Furlong
@test_throws MethodError collect(Furlong(2):Furlong(10)) # step size is ambiguous
@test_throws MethodError range(Furlong(2), 9) # step size is ambiguous
@test collect(Furlong(2):Furlong(1):Furlong(10)) == range(Furlong(2),Furlong(1),9) == Furlong.(2:10)
@test collect(Furlong(2):Furlong(1):Furlong(10)) == collect(range(Furlong(2),Furlong(1),9)) == Furlong.(2:10)
@test collect(Furlong(1.0):Furlong(0.5):Furlong(10.0)) ==
collect(Furlong(1):Furlong(0.5):Furlong(10)) == Furlong.(1:0.5:10)

0 comments on commit fb913a7

Please sign in to comment.