-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from milankl/drwatson32,16-and-sherlog16
logbook interface, min max
- Loading branch information
Showing
8 changed files
with
273 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
@testset "Logbook count 64" begin | ||
|
||
n = 100 | ||
|
||
# A SINGLE ENTRY IN THE LOGBOOK | ||
reset_logbook() | ||
Sherlog64(0)+Sherlog64(0) | ||
lb = get_logbook() | ||
@test 1 == sum(lb) | ||
|
||
# N ENTRIES IN THE LOGBOOK | ||
reset_logbook() | ||
a = Sherlog64(1.0) | ||
for i in 1:n | ||
a + randn(Float64) # promotion included | ||
end | ||
lb = get_logbook() | ||
@test n == sum(lb) | ||
end | ||
|
||
@testset "Logbook count 32" begin | ||
|
||
n = 100 | ||
|
||
# A SINGLE ENTRY IN THE LOGBOOK | ||
reset_logbook() | ||
Sherlog32(0)+Sherlog32(0) | ||
lb = get_logbook() | ||
@test 1 == sum(lb) | ||
|
||
# N ENTRIES IN THE LOGBOOK | ||
reset_logbook() | ||
a = Sherlog32(1.0) | ||
for i in 1:n | ||
a + randn(Float32) # promotion included | ||
end | ||
lb = get_logbook() | ||
@test n == sum(lb) | ||
end | ||
|
||
@testset "Logbook count 16" begin | ||
|
||
n = 100 | ||
|
||
# A SINGLE ENTRY IN THE LOGBOOK | ||
reset_logbook() | ||
Sherlog16(0)+Sherlog16(0) | ||
lb = get_logbook() | ||
@test 1 == sum(lb) | ||
|
||
# N ENTRIES IN THE LOGBOOK | ||
reset_logbook() | ||
a = Sherlog16(1.0) | ||
for i in 1:n | ||
a + randn(Float16) # promotion included | ||
end | ||
lb = get_logbook() | ||
@test n == sum(lb) | ||
end | ||
|
||
@testset "Minimum, maximum logbook Float16" begin | ||
|
||
n = 100 | ||
|
||
for T in [Float16,Float32,Float64] | ||
|
||
# MAXIMUM | ||
for _ in 1:n | ||
i = rand(1:32) # pick a random logbook | ||
reset_logbook(i) # set it to zero | ||
x = rand(T) | ||
Sherlogs.log_it(Float16,x,i) # log a random Float16 | ||
logbook = get_logbook(i) | ||
@test Float16(x) == maximum(logbook) | ||
end | ||
|
||
# MINIMUM | ||
for _ in 1:n | ||
i = rand(1:32) # pick a random logbook | ||
reset_logbook(i) # set it to zero | ||
x = -rand(Float16) | ||
Sherlogs.log_it(Float16,x,i) # log a random Float16 | ||
logbook = get_logbook(i) | ||
@test Float16(x) == minimum(logbook) | ||
end | ||
end | ||
end |
Oops, something went wrong.
30645f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
30645f0
There was a problem hiding this comment.
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/41180
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: