Skip to content

Commit

Permalink
add first real test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjaffray committed Jan 30, 2024
1 parent 3602fef commit 549d860
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
MRIGradients = "6ea382ba-d04a-44a2-b811-544bd2aee867"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
Waveforms = "cb13b1c6-351e-5134-b3ad-d6a530956a82"
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ MRIGradients = "6ea382ba-d04a-44a2-b811-544bd2aee867"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Waveforms = "cb13b1c6-351e-5134-b3ad-d6a530956a82"
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ using Test
using Scratch
using Statistics
using JLD2
using Waveforms

global const tmpdir = @get_scratch!("temp")
@info "For the output of tests, please refer to the directory $tmpdir"
Expand Down
14 changes: 13 additions & 1 deletion test/testMRIGradients.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
function test_grads()

# Placeholder for now
@test true
girf_applier_k1 = load_object("data/girf_app_k1.jld2")

time_vector = collect(0:1000) ./ 100
testSinusoid = map(x -> trianglewave1(x), time_vector) # options are squarewave1 or sawtoothwave1 as well

# correct test data to increase frequency artificially, and also set the first gradient sample to start at 0
testSinusoid[1] = 0
time_vector = time_vector ./ 1000

## Filter test data with GIRF
correctedGradients = apply_girf(girf_applier_k1, testSinusoid, time_vector, time_vector, 1)

@test abs.(correctedGradients[end] - -0.0258168) < 1e-6

end

Expand Down

0 comments on commit 549d860

Please sign in to comment.