Source code

Revision control

Copy as Markdown

Other Tools

<!--
View this file in Typedoc!
- Or locally:
- npm run tsdoc
- npm start
This file is parsed as a tsdoc.
-->
## Index of Test Helpers
This index is a quick-reference of helper functions in the test suite.
Use it to determine whether you can reuse a helper, instead of writing new code,
to improve readability and reviewability.
Whenever a new generally-useful helper is added, it should be indexed here.
**See linked documentation for full helper listings.**
- {@link common/framework/params_builder!CaseParamsBuilder} and {@link common/framework/params_builder!SubcaseParamsBuilder}:
Combinatorial generation of test parameters. They are iterated by the test framework at runtime.
See `examples.spec.ts` for basic examples of how this behaves.
- {@link common/framework/params_builder!CaseParamsBuilder}:
`ParamsBuilder` for adding "cases" to a test.
- {@link common/framework/params_builder!CaseParamsBuilder#beginSubcases}:
"Finalizes" the `CaseParamsBuilder`, returning a `SubcaseParamsBuilder`.
- {@link common/framework/params_builder!SubcaseParamsBuilder}:
`ParamsBuilder` for adding "subcases" to a test.
### Fixtures
(Uncheck the "Inherited" box to hide inherited methods from documentation pages.)
- {@link common/framework/fixture!Fixture}: Base fixture for all tests.
- {@link webgpu/gpu_test!GPUTest}: Base fixture for WebGPU tests.
- {@link webgpu/api/validation/validation_test!ValidationTest}: Base fixture for WebGPU validation tests.
- {@link webgpu/shader/validation/shader_validation_test!ShaderValidationTest}: Base fixture for WGSL shader validation tests.
- {@link webgpu/idl/idl_test!IDLTest}:
Base fixture for testing the exposed interface is correct (without actually using WebGPU).
### WebGPU Helpers
- {@link webgpu/capability_info}: Structured information about texture formats, binding types, etc.
- {@link webgpu/constants}:
Constant values (needed anytime a WebGPU constant is needed outside of a test function).
- {@link webgpu/util/texture}: Helpers for GPUTextures.
- {@link webgpu/util/unions}: Helpers for various union typedefs in the WebGPU spec.
- {@link webgpu/util/math}: Helpers for common math operations.
- {@link webgpu/util/check_contents}: Check the contents of TypedArrays, with nice messages.
Also can be composed with {@link webgpu/gpu_test!GPUTest#expectGPUBufferValuesPassCheck}, used to implement
GPUBuffer checking helpers in GPUTest.
- {@link webgpu/util/conversion}: Numeric encoding/decoding for float/unorm/snorm values, etc.
- {@link webgpu/util/copy_to_texture}:
Helper class for copyToTexture test suites for execution copy and check results.
- {@link webgpu/util/color_space_conversion}:
Helper functions to do color space conversion. The algorithm is the same as defined in
CSS Color Module Level 4.
- {@link webgpu/util/create_elements}:
Helpers for creating web elements like HTMLCanvasElement, OffscreenCanvas, etc.
- {@link webgpu/util/shader}: Helpers for creating fragment shader based on intended output values, plainType, and componentCount.
- {@link webgpu/util/prng}: Seed-able deterministic pseudo random number generator. Replacement for Math.random().
- {@link webgpu/util/texture/base}: General texture-related helpers.
- {@link webgpu/util/texture/data_generation}: Helper for generating dummy texture data.
- {@link webgpu/util/texture/layout}: Helpers for working with linear image data
(like in copyBufferToTexture, copyTextureToBuffer, writeTexture).
- {@link webgpu/util/texture/subresource}: Helpers for working with texture subresource ranges.
- {@link webgpu/util/texture/texel_data}: Helpers encoding/decoding texel formats.
- {@link webgpu/util/texture/texel_view}: Helper class to create and view texture data through various representations.
- {@link webgpu/util/texture/texture_ok}: Helpers for checking texture contents.
- {@link webgpu/shader/types}: Helpers for WGSL data types.
- {@link webgpu/shader/execution/expression/expression}: Helpers for WGSL expression execution tests.
- {@link webgpu/web_platform/util}: Helpers for web platform features (e.g. video elements).
### General Helpers
- {@link common/framework/resources}: Provides the path to the `resources/` directory.
- {@link common/util/navigator_gpu}: Finds and returns the `navigator.gpu` object or equivalent.
- {@link common/util/util}: Miscellaneous utilities.
- {@link common/util/util!assert}: Assert a condition, otherwise throw an exception.
- {@link common/util/util!unreachable}: Assert unreachable code.
- {@link common/util/util!assertReject}, {@link common/util/util!resolveOnTimeout},
{@link common/util/util!rejectOnTimeout},
{@link common/util/util!raceWithRejectOnTimeout}, and more.
- {@link common/util/collect_garbage}:
Attempt to trigger garbage collection, for testing that garbage collection is not observable.
- {@link common/util/preprocessor}: A simple template-based, non-line-based preprocessor,
implementing if/elif/else/endif. Possibly useful for WGSL shader generation.
- {@link common/util/timeout}: Use this instead of `setTimeout`.
- {@link common/util/types}: Type metaprogramming helpers.