Skip to content

Commit

Permalink
added test to check the predicted output
Browse files Browse the repository at this point in the history
  • Loading branch information
kainkad committed Jan 6, 2025
1 parent 33788fe commit 6b04f6d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/ffi/booster.jl
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ end
"4.0,5.0,1"
]
data_filename = "dummy_data.csv"
result_filename = "dummy_predictions.csv"
# saving to .txt file so that it can be read without bringng in CSV.jl or other dependency
result_filename = "dummy_predictions.txt"
open(data_filename, "w") do f
for line in data
println(f, line)
Expand All @@ -417,6 +418,14 @@ end
# Check if the result file is created
@test isfile(result_filename)

# Read the results file and check the scores
open(result_filename, "r") do f
lines = readlines(f)
scores = parse.(Float64, lines)
@test length(scores) == 4
@test all(0 .<= scores .<= 1)
end

# Clean up
rm(data_filename, force=true)
rm(result_filename, force=true)
Expand Down

0 comments on commit 6b04f6d

Please sign in to comment.