Skip to content

Commit 13825ef

Browse files
committed
Add thorough testing for ExponentialUtilities.jl
This is to explore the functionalities of the package and the guarantee that everythink works reliably.
1 parent 9557f58 commit 13825ef

4 files changed

Lines changed: 637 additions & 1 deletion

File tree

CLAUDE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,20 @@ Uses SafeTestsets for isolated test execution. Tests are comprehensive and inclu
7676

7777
Running `make test` prints out coverage data in a table.
7878

79+
Tips for writing tests:
80+
81+
- Use functions like `random_state_vector`, `random_dynamic_generator`, `random_matrix` from `QuantumControlTestUtils.RandomObjects` to generate random objects. These should always be given an explicit `StableRNG` as `rng`, with a unique seed
82+
83+
- When a new seed is required, obtain one with `julia --project=test -e 'using QuantumControlTestUtils.RandomObjects: randseed; print(randseed())'`
84+
85+
7986
If necessary, detailed line-by-line coverage information can be obtained by running julia --project=test -e 'include("devrepl.jl"); generate_coverage_html()' after `make test`.
8087
This will produce html files inside the `coverage` subfolder, with `coverage/src` mirroring the structure of the `src` folder of `.jl` files. Lines with `<span class="tlaUNC">` are not covered. Ignore the raw tracefiles in the `.coverage` subfolder.
8188

8289
### Development Environment
90+
8391
The project uses a sophisticated development setup:
92+
8493
- Development REPL (devrepl.jl) with Revise.jl for hot reloading
8594
- Automatic dependency management via installorg.jl script
8695
- Integrated documentation building and serving
@@ -100,4 +109,6 @@ Each Julia function that is not explicitly private or has a name starting with a
100109

101110
* When adding a new dependency to any `Project.toml` file, run `make distclean`, and then `make test/Manifest.toml`, `make docs/Manifest.toml`, etc. to recreate manifest files as necessary.
102111

112+
* In order to get the documentation (docstring) of any function, e.g., `some_func`, in any package in the test environment, e.g., `SomeLib`, run `julia --project=. -e 'using REPL; using SomeLib; print(Base.doc(SomeLib.some_func))'`
113+
103114
* Never commit any changes or ask to commit. I will always create git commits manually.

src/generators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function Base.show(io::IO, O::ScaledOperator{CT,OT}) where {CT,OT}
256256
print(io, "ScaledOperator($(O.coeff), $(O.operator))")
257257
end
258258

259-
function Base.show(io::IO, ::MIME"text/plain", O::ScaledOperator{CT,OT}) where {CT,OT}
259+
function Base.show(io::IO, ::MIME"text/plain", O::ScaledOperator{CT,<:Operator}) where {CT}
260260
Base.summary(io, O)
261261
println(io, "\n operator.ops::$(typeof(O.operator.ops)):")
262262
for op in O.operator.ops

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ using SafeTestsets
7878
include("test_expprop.jl")
7979
end
8080

81+
println("\n* ExponentialUtilities (test_exponential_utilities.jl):")
82+
@time @safetestset "ExponentialUtilities" begin
83+
include("test_exponential_utilities.jl")
84+
end
85+
8186
println("\n* Propagator Interfaces (test_prop_interfaces.jl):")
8287
@time @safetestset "Propagator Interfaces" begin
8388
include("test_prop_interfaces.jl")

0 commit comments

Comments
 (0)