Skip to content

Commit

Permalink
add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Datseris committed Aug 10, 2020
1 parent d6faefe commit 745e242
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
language: julia
os:
- linux
- windows
- osx

julia:
- 1
- 1.0
# - nightly

before_script:
- git config --global user.name "GitUser"
- git config --global user.email "git@us.er"

matrix:
allow_failures:
- julia: nightly
fast_finish: true
include:
- stage: "Documentation"
julia: 1
os: linux
script:
- julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd()));
Pkg.instantiate();'
- julia --project=docs/ docs/make.jl
after_success: skip
notifications:
email: false
7 changes: 7 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[compat]
julia = "1"
StaticArrays = "0.12"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[targets]
test = ["Test", "Statistics"]
3 changes: 2 additions & 1 deletion src/ARFIMA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ max(P+1, ceil(Int, log(0.001)/log(maximum(abs, φ))))

"""
autoregressive(N, Z, φ::SVector{P}) -> X
Generate an autoregressive process based on input noise term `Z`.
Generate an autoregressive process of length `N` based on input noise term `Z`.
This is used in both ARFIMA and ARMA.
The noise term must have at least `N+P` elements.
"""
function autoregressive(N, Z, φ::SVector{P}) where {P}
L = length(Z) - N; @assert L > P
Expand Down
21 changes: 21 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Test, ARFIMA, Statistics

N = 1000
σ = 2.3

x = arfima(N, σ, nothing) # white noise
@test abs(std(x) - σ) < 1
@test length(x) == N

x = arfima(N, σ, nothing, SVector(0.2, 0.2))
@test length(x) == N
@test all(!isinf, x)
x = arfima(N, σ, nothing, SVector(0.2,0.2), SVector(0.1))
@test length(x) == N
@test all(!isinf, x)
x = arfima(N, σ, 1, SVector(0.02,0.02), SVector(0.01))
@test length(x) == N
@test all(!isinf, x)
x = arfima(N, σ, 0.25, SVector(0.02,0.02), SVector(0.01))
@test length(x) == N
@test all(!isinf, x)

2 comments on commit 745e242

@Datseris
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/19289

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.0 -m "<description of version>" 745e2423efe43de0c91327e9d41b33df32a1029f
git push origin v0.3.0

Also, note the warning: This looks like a new registration that registers version 0.3.0.
Ideally, you should register an initial release with 0.0.1, 0.1.0 or 1.0.0 version numbers
This can be safely ignored. However, if you want to fix this you can do so. Call register() again after making the fix. This will update the Pull request.

Please sign in to comment.