Skip to content

Commit

Permalink
Doctests for Julia 0.7/1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
diegozea committed Nov 21, 2018
1 parent 4263e42 commit 11b8202
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 174 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ os:
julia:
- 0.7
- 1.0
- nightly

notifications:
email: false

Expand All @@ -16,4 +18,4 @@ after_success:
- julia -e 'using Pkg; using PairwiseListMatrices; cd(dirname(pathof(PairwiseListMatrices))); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
- julia -e 'using Pkg; Pkg.add("Documenter")'
- julia -e 'using Pkg; Pkg.add("Plots"); Pkg.add("GR")' # Plots
- julia -e 'cd(dirname(pathof(PairwiseListMatrices))); include(joinpath("docs", "make.jl"))'
- julia -e 'cd(dirname(pathof(PairwiseListMatrices))); include(joinpath("..", "docs", "make.jl"))'
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ PairwiseListMatrices v0.6 was the last version with Julia 0.6 support.

* `writecsv` changed to `writedlm` using `delim=','`.

* A type parameter to indicate the wrapped matrix type was added to
`NamedResidueMatrix`, which is now `NamedResidueMatrix{Array{Residue,2}}`.

### Changes from v0.5 to v0.6

PairwiseListMatrices v0.6 requires Julia v0.6.
Expand Down
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
julia 0.7 1.0
julia 0.7
NamedArrays
RecipesBase
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ environment:
matrix:
- julia_version: 0.7
- julia_version: 1.0
- julia_version: latest

platform:
- x86 # 32-bit
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Documenter, PairwiseListMatrices

makedocs(
doctest = true,
format = :html,
sitename = "PairwiseListMatrices",
modules = [PairwiseListMatrices],
Expand All @@ -13,7 +14,6 @@ makedocs(
deploydocs(
repo = "github.com/diegozea/PairwiseListMatrices.jl.git",
target = "build",
julia = "0.6",
deps = nothing,
make = nothing
)
16 changes: 7 additions & 9 deletions src/PairwiseListMatrices.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
__precompile__()

"""
This package allows you to use a pairwise list as a symmetric matrix.
```julia
using PairwiseListMatrices
```
"""
module PairwiseListMatrices

# standard libraries
Expand Down Expand Up @@ -28,18 +34,10 @@ export @iterateupper,
from_table, to_table,
to_dict,
join,
to_dataframe, from_dataframe
writedlm

include("macros.jl")
include("pairwiselistmatrix.jl")
include("plotrecipes.jl")

function to_dataframe(args...)
throw(ErrorException("Deprecated function, use DataFrame(to_dict(args...)) instead."))
end

function from_dataframe(args...)
throw(ErrorException("Deprecated function, use from_table(args...) instead."))
end

end
24 changes: 16 additions & 8 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ In the body `list` will be the list field of the `PairwiseListMatrix` and `k` th
over that list. Other variables should be interpolated in a quote. You must not modify the
value of `k`.
```julia
```jldoctest
julia> using PairwiseListMatrices
julia> PLM = PairwiseListMatrix([1,2,3], false)
3×3 PairwiseListMatrices.PairwiseListMatrix{Int64,false,Array{Int64,1}}:
3×3 PairwiseListMatrix{Int64,false,Array{Int64,1}}:
0 1 2
1 0 3
2 3 0
Expand Down Expand Up @@ -37,17 +39,19 @@ second is the body of the loop. In the body `diag` will be the diag field of the
`PairwiseListMatrix` and `k` the index over that vector.
Other variables should be interpolated in a quote. You must not modify the value of `k`.
```julia
```jldoctest
julia> using PairwiseListMatrices
julia> PLM = PairwiseListMatrix([1,2,3], false)
3×3 PairwiseListMatrices.PairwiseListMatrix{Int64,false,Array{Int64,1}}:
3×3 PairwiseListMatrix{Int64,false,Array{Int64,1}}:
0 1 2
1 0 3
2 3 0
julia> @iteratediag PLM diag[k] += 10k
julia> PLM
3×3 PairwiseListMatrices.PairwiseListMatrix{Int64,false,Array{Int64,1}}:
3×3 PairwiseListMatrix{Int64,false,Array{Int64,1}}:
10 1 2
1 20 3
2 3 30
Expand Down Expand Up @@ -75,9 +79,11 @@ You can also use the respective `i` and `j` indexes for that position `k` in the
triangular part of the matrix. Other variables should be interpolated in a quote.
You must not modify the values of `i`, `j` or `k`.
```julia
```jldoctest
julia> using PairwiseListMatrices
julia> PLM = PairwiseListMatrix([1,2,3], true)
2×2 PairwiseListMatrices.PairwiseListMatrix{Int64,true,Array{Int64,1}}:
2×2 PairwiseListMatrix{Int64,true,Array{Int64,1}}:
1 2
2 3
Expand All @@ -86,7 +92,9 @@ julia> mat = zeros(Int, 2, 2)
0 0
0 0
julia> @iterateupper PLM true :(\$mat)[i,j] = list[k]
julia> let mat = mat # To avoid using global
@iterateupper PLM true :(\$mat)[i,j] = list[k]
end
julia> mat
2×2 Array{Int64,2}:
Expand Down
Loading

0 comments on commit 11b8202

Please sign in to comment.