add tests (count_riseup, DispatchChecker)

This commit is contained in:
Wataru Otsubo 2024-10-03 16:51:44 +09:00
parent ec455cad1b
commit f28b2be611
4 changed files with 370 additions and 0 deletions

View file

@ -4,6 +4,7 @@ using CSV, DataFrames
using SQLite, DBInterface
using Dates
# hack for LanguageServer
true || include("../src/PSBoardDataBase.jl")
@testset "PSBoardDataBase" begin
@ -28,6 +29,10 @@ true || include("../src/PSBoardDataBase.jl")
@test PSBoardDataBase.ClockParser.get_skew_and_riseup(
"input/slavelogs/main/448_103_clk.txt",
) == (12.0, 12.053571428571429 - 11.982142857142858)
@test PSBoardDataBase.ClockParser.count_riseup(
"input/slavelogs/main/444_103_clk.txt",
) == 22
end
@testset "Download data csv" begin
@ -118,6 +123,25 @@ true || include("../src/PSBoardDataBase.jl")
isnothing
run(`sqlitebrowser $dbpath`)
@test PSBoardDataBase.create_database_from_exported_csvs(
tempname();
masterlog_dir = "input/log/",
slavelog_dir = "input/slavelogs/",
) isa SQLite.DB
end
@testset "DbConnection" begin
conn = PSBoardDataBase.DispatchChecker.DbConnection(db)
@test conn.df_single_result isa DataFrame
@info "" conn.df_single_result |> nrow conn.df_extra_results |> nrow
if haskey(ENV, "LOCAL_TEST")
@test PSBoardDataBase.DispatchChecker.is_dispatchable(conn, 443)
@test PSBoardDataBase.DispatchChecker.is_dispatchable(conn, 706) |>
ismissing
end
end
end
end