JuliaLang/julia — pull request #962 by maleadt (2012-06-22 13:21:31+00:00)
Title: Fixing binary operators when comparing arrays with scalars

This pull requests fixes two bugs, the primary one that it is impossible to compare an array with a scalar without using a dot operator, despite the manual saying:
> In case of binary operators, the dot version of the operator should be used when both inputs are non-scalar, and any version of the operator may be used if one of the inputs is a scalar.

Example of this failing:
```julia
julia> foo = rand(5)
5-element Float64 Array:
0.57254
0.824372
0.851157
0.759111
0.475305

julia> bar = 0.5
0.5

julia> foo < bar
no method isless(Array{Float64,1},Float64)
in method_missing at base.jl:60
in < at operators.jl:13

julia> foo .< bar
5-element Bool Array:
false
false
false
false
true
```

This is caused by a bug in base/base.jl, fixed by the first commit.

In order to test that, I wanted to write a simple test case, but then I got confronted with another issue: assert not being able to assert boolean vectors, despite the manual saying:
> Here, for example, is very nearly the definition of Julia’s @assert macro (see error.jl for the actual definition, which allows @assert to work on booleans arrays as well)
My second commit adds support for testing against boolean arrays.

The third commit adds a small test case (which ironically doesn't use the aforementioned @assert functionality any more, as I thought simply comparing arrays might be too trivial for a unit test).