Skip to content

Commit

Permalink
[GWR.jl] GWR unit test set back to the correct version 🔧
Browse files Browse the repository at this point in the history
  • Loading branch information
shayandavoodii committed Nov 2, 2024
1 parent 2e158b4 commit 1b5fd9e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/GWR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,28 @@ n_assets = size(prices, 1)
@testset "GWR.jl" begin
@testset "With default arguments" begin
model = gwr(prices, h)
@test sum(model.b, dims=1) .|> isapprox(1.0, atol=1e-2) |> all
@show sum(model.b, dims=1)
@test sum(model.b, dims=1) .|> isapprox(1.0) |> all
@test model.n_assets == n_assets == size(model.b, 1)
@test (model.b[:, 1] .== 1/n_assets) |> all

model = gwr(prices, h, [1, 2, 3])
@show sum(model.b, dims=1)
@test sum(model.b, dims=1) .|> isapprox(1.0) |> all
@test model.n_assets == n_assets == size(model.b, 1)
@test (model.b[:, 1] .== 1/n_assets) |> all
end

@testset "With custom arguments" begin
model = gwr(prices, h, 1, 20, 0.01)
@test sum(model.b, dims=1) .|> isapprox(1.0, atol=1e-2) |> all
@show sum(model.b, dims=1)
@test sum(model.b, dims=1) .|> isapprox(1.0) |> all
@test model.n_assets == n_assets == size(model.b, 1)
@test (model.b[:, 1] .== 1/n_assets) |> all

model = gwr(prices, h, [2, 3, 3.2], 20, 0.01)
@test sum(model.b, dims=1) .|> isapprox(1.0, atol=1e-2) |> all
@show sum(model.b, dims=1)
@test sum(model.b, dims=1) .|> isapprox(1.0) |> all
@test model.n_assets == n_assets == size(model.b, 1)
@test (model.b[:, 1] .== 1/n_assets) |> all
end
Expand Down

0 comments on commit 1b5fd9e

Please sign in to comment.