Skip to content

Commit fc5801a

Browse files
committed
Add an initial version of tests-coverage.md
1 parent 977bcef commit fc5801a

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

tests-coverage.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
## Coverage of the Test Suite
2+
3+
This document outlines the coverage of the test suite over the
4+
[spec](https://data-apis.org/array-api/) at a high level.
5+
6+
The following things are tested
7+
8+
* **Smoke tested** means that the function has a basic test that calls the
9+
function with some inputs, but does not imply any testing of the output
10+
value. This includes calling keyword arguments to the function, and checking
11+
that it takes the correct number of positional arguments. A smoke test will
12+
fail if the function is not implemented with the correct signature or raises
13+
an exception, but will not check any other aspect of the spec.
14+
15+
* **All Inputs** means that the function is tested with all possible inputs
16+
required by the spec (using hypothesis). This means all possible array
17+
shapes, all possible dtypes (that are required for the given function), and
18+
all possible values for the given dtype (omitting those whose behavior is
19+
undefined).
20+
21+
* **Output Shape** means that the result shape is tested. For functions that
22+
take more than one argument, this means the result shape should produced
23+
from
24+
[broadcasting](https://data-apis.org/array-api/latest/API_specification/broadcasting.html)
25+
the input shapes. For functions of a single argument, the result shape
26+
should be the same as the input shape.
27+
28+
* **Output Dtype** means that the result dtype is tested. For (most) functions
29+
with a single argument, the result dtype should be the same as the input.
30+
For functions with two arguments, there are different possibilities, such as
31+
performing [type
32+
promotion](https://data-apis.org/array-api/latest/API_specification/type_promotion.html)
33+
or always returning a specific dtype (e.g., `equals()` should always return
34+
a `bool` array).
35+
36+
* **Output Values** means that the exact output is tested in some way. For
37+
functions that operate on floating-point inputs, the spec does not require
38+
exact values, so a "Yes" in this case will mean only that the output value
39+
is checked to be "close" to the numerically correct result. The exception to
40+
this is special cases for elementwise functions, which are tested exactly.
41+
For functions that operate on non-floating-point inputs, or functions like
42+
manipulation functions or indexing that simply rearrange the same values of
43+
the input arrays, a "Yes" means that the exact values are tested. Note that
44+
in many cases, certain values of inputs are left unspecified, and are thus
45+
not tested (e.g., the behavior for division by integer 0 is unspecified).
46+
47+
* **Stacking** means that functions that operate on "stacks" of smaller data
48+
are tested to produce the same result on a stack as on the individual
49+
components. For example, an elementwise function on an array
50+
should produce the same output values as the same function called on each
51+
value individually, or a linalg function on a stack of matrices should
52+
produce the same value when called on individual matrices. Here "same" may
53+
only mean "close" when the input values are floating-point.
54+
55+
## Statistical Functions
56+
57+
|----------|------------|------------|--------------|--------------|---------------|----------|
58+
| Function | Smoke Test | All Inputs | Output Shape | Result Dtype | Output Values | Stacking |
59+
|----------|------------|------------|--------------|--------------|---------------|----------|
60+
| max | Yes | Yes | Yes | Yes | | |
61+
| mean | Yes | Yes | Yes | Yes | | |
62+
| min | Yes | Yes | Yes | Yes | | |
63+
| prod | Yes | Yes | Yes | Yes (1) | | |
64+
| std | Yes | Yes | Yes | Yes | | |
65+
| sum | Yes | Yes | Yes | Yes (1) | | |
66+
| var | Yes | Yes | Yes | Yes | | |
67+
68+
(1): `sum` and `prod` have special type promotion rules.

0 commit comments

Comments
 (0)