Skip to content

Commit

Permalink
Fixup discrete distributions, add profiling for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mharradon committed Apr 14, 2024
1 parent 40afa21 commit 30533b1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,5 @@ scratch/separable/path.jl

test/ABP.png
ABP.png

output
Empty file added output/.gitignore
Empty file.
21 changes: 21 additions & 0 deletions test/profile_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Profile

include("runtests.jl")
@profile include("runtests.jl")

open("output/profile_tree.txt", "w") do s
Profile.print(IOContext(s, :displaysize => (24, 500));
format=:tree,
maxdepth=60,
noisefloor=4,
mincount=4)
end

open("output/profile_flat.txt", "w") do s
Profile.print(IOContext(s, :displaysize => (24, 500));
format=:flat,
sortedby=:count,
maxdepth=60,
noisefloor=4,
mincount=4)
end
4 changes: 0 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# File test/runtests.jl
module ScruffTest

using Test

@testset "ScruffTests" begin
Expand All @@ -24,5 +22,3 @@ using Test
include("../docs/examples/soccer_example.jl")
end
end

end
2 changes: 1 addition & 1 deletion test/test_sfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ end
N = 100
samples = [sample(sf, ()) for _ in 1:N]
sf_mean = expectation(sf, ())
@test isapprox(sf_mean, sum(samples) / N; atol=0.1)
@test isapprox(sf_mean, sum(samples) / N; atol=0.2)

# must handle duplicates in range correctly
c3 = Discrete([1, 1, 2],
Expand Down

0 comments on commit 30533b1

Please sign in to comment.