Skip to content

Commit

Permalink
Add parse_log function and corresponding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SAYANTANDE committed Jul 17, 2024
1 parent da6595d commit d25fa8f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/test_parse_log.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Test

include("parse_log.jl")

# Mock log data for testing
const mock_log = [
(action = (type = :source, funct = :importcsv), info = ()),
(action = (type = :analysis, funct = :modelfit), info = (model_name = "maxwell", model_params = Dict("η" => 76.30267813573391, "k" => 0.5451389878296595), error = 4.234991209005228)),
(action = (type = :analysis, funct = :modelfit), info = (model_name = "SLS_Zener", model_params = Dict("η" => 0.2995472252368927, "kᵦ" => 1.0333390861749647, "kᵧ" => 0.5), error = 3.134312236497204e-11)),
]

# Define the test function
function test_parse_log()
expected_output = Dict(
"maxwell" => [
Dict("params" => Dict("η" => 76.30267813573391, "k" => 0.5451389878296595), "error" => 4.234991209005228, "index" => 2),
],
"SLS_Zener" => [
Dict("params" => Dict("η" => 0.2995472252368927, "kᵦ" => 1.0333390861749647, "kᵧ" => 0.5), "error" => 3.134312236497204e-11, "index" => 3),
]
)

actual_output = parse_log(mock_log)

@test actual_output == expected_output
end

# Run tests
@testset "Tests for parse_log function" begin
@testset "Basic functionality" begin
test_parse_log()
end
end

0 comments on commit d25fa8f

Please sign in to comment.