Skip to content

Commit 7a997d7

Browse files
Merge pull request #94 from ChrisRackauckas-Claude/agent/public-doc-coverage
Document exported strategy kind constants
2 parents f932fdd + 2965aa7 commit 7a997d7

3 files changed

Lines changed: 117 additions & 0 deletions

File tree

docs/src/strategies.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ FindFirstFunctions.strategy_kind
4949
| `KIND_UNIFORM_STEP` | `UniformStep` | `_kernel_last_uniform_step` / `_kernel_first_uniform_step` |
5050
| `KIND_BISECT_THEN_SIMD` | `BisectThenSIMD` | (positional dispatch falls back to BinaryBracket; equality dispatch goes through `findfirstsortedequal`) |
5151

52+
```@docs
53+
FindFirstFunctions.KIND_BINARY_BRACKET
54+
FindFirstFunctions.KIND_LINEAR_SCAN
55+
FindFirstFunctions.KIND_SIMD_LINEAR_SCAN
56+
FindFirstFunctions.KIND_BRACKET_GALLOP
57+
FindFirstFunctions.KIND_EXP_FROM_LEFT
58+
FindFirstFunctions.KIND_INTERPOLATION_SEARCH
59+
FindFirstFunctions.KIND_BIT_INTERPOLATION_SEARCH
60+
FindFirstFunctions.KIND_UNIFORM_STEP
61+
FindFirstFunctions.KIND_BISECT_THEN_SIMD
62+
```
63+
5264
Stateful strategies that do **not** have an enum tag and stay on the
5365
multimethod path:
5466

src/kinds.jl

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,78 @@ that carries it.
4949
KIND_BISECT_THEN_SIMD
5050
end
5151

52+
# Julia 1.10's `@enum` does not accept inline docstrings for individual
53+
# values, so keep per-kind docs immediately next to the enum definition.
54+
@doc """
55+
KIND_BINARY_BRACKET::StrategyKind
56+
57+
Select [`BinaryBracket`](@ref FindFirstFunctions.BinaryBracket), the plain
58+
binary-search fallback for positional sorted searches.
59+
""" KIND_BINARY_BRACKET
60+
61+
@doc """
62+
KIND_LINEAR_SCAN::StrategyKind
63+
64+
Select [`LinearScan`](@ref FindFirstFunctions.LinearScan), the hinted
65+
strategy that walks linearly from a nearby index.
66+
""" KIND_LINEAR_SCAN
67+
68+
@doc """
69+
KIND_SIMD_LINEAR_SCAN::StrategyKind
70+
71+
Select [`SIMDLinearScan`](@ref FindFirstFunctions.SIMDLinearScan), the
72+
hinted linear scan with SIMD-specialized forward walks for supported dense
73+
vectors.
74+
""" KIND_SIMD_LINEAR_SCAN
75+
76+
@doc """
77+
KIND_BRACKET_GALLOP::StrategyKind
78+
79+
Select [`BracketGallop`](@ref FindFirstFunctions.BracketGallop), the hinted
80+
strategy that expands a bidirectional exponential bracket before binary
81+
searching inside it.
82+
""" KIND_BRACKET_GALLOP
83+
84+
@doc """
85+
KIND_EXP_FROM_LEFT::StrategyKind
86+
87+
Select [`ExpFromLeft`](@ref FindFirstFunctions.ExpFromLeft), the hinted
88+
strategy that treats the hint as a left bound and searches forward
89+
exponentially.
90+
""" KIND_EXP_FROM_LEFT
91+
92+
@doc """
93+
KIND_INTERPOLATION_SEARCH::StrategyKind
94+
95+
Select [`InterpolationSearch`](@ref FindFirstFunctions.InterpolationSearch),
96+
the strategy that guesses from linear extrapolation across the vector
97+
endpoints.
98+
""" KIND_INTERPOLATION_SEARCH
99+
100+
@doc """
101+
KIND_BIT_INTERPOLATION_SEARCH::StrategyKind
102+
103+
Select
104+
[`BitInterpolationSearch`](@ref FindFirstFunctions.BitInterpolationSearch),
105+
the opt-in interpolation strategy that guesses from Float64 bit patterns.
106+
""" KIND_BIT_INTERPOLATION_SEARCH
107+
108+
@doc """
109+
KIND_UNIFORM_STEP::StrategyKind
110+
111+
Select [`UniformStep`](@ref FindFirstFunctions.UniformStep), the direct
112+
arithmetic lookup strategy for uniformly-spaced vectors and ranges.
113+
""" KIND_UNIFORM_STEP
114+
115+
@doc """
116+
KIND_BISECT_THEN_SIMD::StrategyKind
117+
118+
Select [`BisectThenSIMD`](@ref FindFirstFunctions.BisectThenSIMD), the
119+
sorted-equality strategy used by [`findequal`](@ref FindFirstFunctions.findequal).
120+
The positional sorted-search dispatch falls back to
121+
[`BinaryBracket`](@ref FindFirstFunctions.BinaryBracket).
122+
""" KIND_BISECT_THEN_SIMD
123+
52124
"""
53125
searchsorted_last(kind::StrategyKind, v, x[, hint]; order = Base.Order.Forward)
54126
searchsorted_last(s, v, x[, hint]; order = Base.Order.Forward)

test/qa/qa.jl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,36 @@ run_qa(
2020
),
2121
),
2222
)
23+
24+
@testset "Public API documentation coverage" begin
25+
public_names = setdiff(
26+
Set(names(FindFirstFunctions; all = false, imported = false)),
27+
Set((nameof(FindFirstFunctions),)),
28+
)
29+
30+
documented_names = Set{Symbol}()
31+
for binding in keys(Base.Docs.meta(FindFirstFunctions))
32+
binding.mod === FindFirstFunctions && push!(documented_names, binding.var)
33+
end
34+
35+
docs_names = Set{Symbol}()
36+
docs_dir = joinpath(pkgdir(FindFirstFunctions), "docs", "src")
37+
for file in readdir(docs_dir; join = true)
38+
endswith(file, ".md") || continue
39+
in_docs_block = false
40+
for line in eachline(file)
41+
stripped = strip(line)
42+
if startswith(stripped, "```@docs")
43+
in_docs_block = true
44+
elseif in_docs_block && startswith(stripped, "```")
45+
in_docs_block = false
46+
elseif in_docs_block
47+
m = match(r"^FindFirstFunctions\.([A-Za-z_][A-Za-z_0-9!]*$)", stripped)
48+
m === nothing || push!(docs_names, Symbol(m.captures[1]))
49+
end
50+
end
51+
end
52+
53+
@test isempty(setdiff(public_names, documented_names))
54+
@test isempty(setdiff(public_names, docs_names))
55+
end

0 commit comments

Comments
 (0)