NativeGrep.Types: search modes, options, byte-offset results, statistics, cancellation, and sink interface.NativeGrep.Api:TNativeGrep.Search,SearchStream,SearchBytesas the synchronous public facade.SourcePathis a display name;ByteOffsetis 0-based,Line/Columnare 1-based or 0 when not computed.- The library calls sink methods only sequentially on the calling thread. No direct VCL dependency.
SearchStreamdoes not take ownership of the stream and starts at its current position.SearchByteskeeps no user buffer after returning.MaxWorkers=0: auto (capped at 8), explicit 1 to 64. Worker matchers are never shared between threads.SortResults=False: direct completion order.SortResults=True: defined path/byte-offset ordering, then the global result limit; may use temp files.
- Build
apps/npgrep/npgrep.dprojfor Win64 Debug, no compiler errors. - Build
tests/NativeGrep.Tests.dprojfor Win64 Debug;NativeGrep.Tests.exemust printPASS. - Build the same projects for Win64 Release and re-run the tests.
- Run
tests/Invoke-NativeGrepCliSmoke.ps1against the built Release EXE. - Compare
--threads 1,4,8against real directories; without--sortthe match set must be identical, with--sortthe match order must be identical. - Check cancellation under a full result queue, sort-merge cancellation, and an exception from a sink (dedicated Delphi tests).
- Check the temp location: large sorted searches need enough space and write access; no leftover sort files after normal completion or on an error/cancel path.
- Check missing/locked files: other files keep scanning, errors surface through the sink and CLI exit code 2.
- For Unicode: test sigma, U+00DF (eszett), NFD, UTF-8/UTF-16 BOM, invalid sequences, and byte offsets across chunk boundaries.
- Test a sparse file over 4 GiB and large real files for correct Int64 offsets on the target system. This run is separate from the regular quick test.
- Measure Release performance with 1/2/4/8 workers against representative HDD/SSD data; never interpret cache-warm-only runs as raw disk throughput.
.\bin\Win64\Release\npgrep.exe --help
.\bin\Win64\Release\NativeGrep.Tests.exe
powershell -NoProfile -ExecutionPolicy Bypass -File .\tests\Invoke-NativeGrepCliSmoke.ps1 -Exe .\bin\Win64\Release\npgrep.exeNativeGrep.Tests.exe may land elsewhere depending on the project's output path; use its actual path in that case. CLI exit codes: 0 = matches found, 1 = no matches, 2 = error or invalid arguments, 130 = aborted via Ctrl+C.
Place Win64 pcre2-8.dll beside each test or application EXE used by regex tests, including both Debug and Release builds. The DLL must provide PCRE2 10.x with Unicode support. Without it, regex integration cases are reported as skipped; a passing non-regex run does not verify regex behavior.
Run the additional regex smoke script against the Release CLI:
powershell -NoProfile -ExecutionPolicy Bypass -File .\tests\Invoke-NativeGrepRegexSmoke.ps1 -Exe .\bin\Win64\Release\npgrep.exeSee replacement tests for backup, cancellation, and filesystem cases.