Skip to content

Reorganize tests into named testsets and cover UDF value marshalling (#270)#351

Open
JohnCobbler wants to merge 2 commits into
JuliaDatabases:masterfrom
JohnCobbler:test/270-testset-reorg
Open

Reorganize tests into named testsets and cover UDF value marshalling (#270)#351
JohnCobbler wants to merge 2 commits into
JuliaDatabases:masterfrom
JohnCobbler:test/270-testset-reorg

Conversation

@JohnCobbler
Copy link
Copy Markdown

Closes #270.

The suite was one ~1000-line file with three coarse top-level testsets, so it was hard to see which setup belonged to which tests or what each group asserted. This restructures test/runtests.jl into named @testset blocks grouped by functional area (DB open/close, tables interface, execute/query, transactions, load!/drop!, strict mode, UDF registration, serialization, backup, Stmt scope, …) under a single top-level SQLite testset. State-coupled blocks are kept together and annotated, and a couple of previously cross-test-shared tables are recreated locally so each testset stands alone.

Commit 1 is a pure reorganization with zero semantic changes — no test added, removed, reordered across a state dependency, or weakened; assertion count unchanged and the suite still reports 181 passing tests.

Commit 2 adds a UDF value marshalling testset that round-trips values through a registered identity UDF and asserts exact equality. The Int64-boundary integer cases close a real coverage gap surfaced by mutation testing: nothing previously passed a UDF an integer outside the Int32 range, so the word-size branch in sqlvalue could be flipped to the 32-bit read path and silently truncate large integers with no failing test. The remaining cases cover the Float64, String (including multi-byte UTF-8), blob and NULL branches.

Reorganize the monolithic test/runtests.jl into named @testset blocks
grouped by functional area (type conversion, DB open/close, tables
interface, execute/query, transactions, load!/drop!, strict mode, UDF
registration, serialization, Dates, backup, Stmt scope) under a single
top-level "SQLite" testset.

This is a pure reorganization with no semantic changes: no test is
added, removed, reordered across a state dependency, or weakened. The
assertion count is unchanged (155 @test + 22 @test_throws) and the suite
reports the same 181 passing tests as before. State-coupled blocks are
kept together and annotated; a couple of previously-shared tables are
recreated locally so each testset is self-contained.

Addresses JuliaDatabases#270.
Add a "UDF value marshalling" testset that round-trips values through a
registered identity UDF, exercising both SQLite.sqlvalue (argument
unmarshalling) and SQLite.sqlreturn (result marshalling) and asserting
exact equality.

The Int64-boundary cases (typemax/typemin(Int64), 2^40, 2^31, the Int32
limits and values just past them) close a real coverage gap: nothing in
the suite previously passed a UDF an integer outside the Int32 range, so
the `Sys.WORD_SIZE == 64` branch in sqlvalue was untested — flipping it to
sqlite3_value_int (the 32-bit path) silently truncated large integers
with no failing test. The remaining cases cover the Float64, String, blob
and NULL branches of sqlvalue.

Addresses JuliaDatabases#270.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reorganize Tests into Testsets

1 participant