-
Notifications
You must be signed in to change notification settings - Fork 13
Test Naming Conventions
These are the naming conventions currently used in the included unit_tests.c. You can use this as a reference in knowing what queries to run by name or wildcard search in order to select specific types of tests to run, enable, or disable as needed.
- d, i, u, x, X, c, s, p tests start with
d_
,i_
,u_
, etc. -
%%
tests start withpct_
- Precision tests (
.
) have 'prec
' in the name - Field width tests usually have '
width
' or just 'w
' in the name -
*
Tests havestar
in the name. - Mandatory Format flags
-
0
(zero padding) tests usually have 'zp
' in the name -
-
(left justify) tests usually have 'lj
' in the name - Combined flags will sometimes concatenate the above, e.g.
_zplj_
. There is no defined order.
-
- Tests that start with
mix_
are tests that combine multiple specifiers at random. This block is good for testing whether you handle variadic arguments correctly.
-
nocrash
tests start withnocrash_
. These tests are specially handled and will always pass provided ft_printf does not crash while executing the test. They are disabled by default, except for tests that start withnocrash_mandatory
.
- All tests for bonuses that are mentioned in the subject start with
bonus_
- All tests for bonuses that are mentioned in the subject, but do not test functionality that is tested by moulinette to validate those bonuses, start with
bonus_notrequired_
- Tests to validate
%f
that are deemed mandatory for the bonus start withbonus_f
. - Tests to validate
%g
that are deemed mandatory for the bonus start withbonus_g
. - Tests to validate
%e
that are deemed mandatory for the bonus start withbonus_e
. -
hh
h
l
ll
tests start withbonus_length
- Bonus Format flags
-
#
tests start withbonus_af
. Other bonus tests that include#
haveaf
in the name. -
+
tests start withbonus_as
. Other bonus tests that include+
haveas
in the name. -
' '
(space padding) tests start withbonus_sp
. Other bonus tests that includesp
in the name. - Combined flags will sometimes concatenate the above, e.g.
_afsp_
. There is no defined order.
-
-
%n
tests will probably start withbonus_n_
, but these tests, and the capability of running these tests, do not exist yet.
- All tests for bonuses that are mentioned in the subject, but do not test functionality that is tested by moulinette to validate those bonuses, start with
bonus_notrequired_
- Tests for the arbitrary argument selector
$
(not in the subject) start withargnum_
- Tests for
%o
start withnotinsubject_o
andnotinsubject_moul_o
- Other tests that test functionality that is not in the subject start with
notinsubject_
. Less commonly, tests may have the_notinsubject_
tag within them. - The tests starting with
bonus_mix
is the mix block from the version on the old curriculum. Unless you validate all of its bonuses, it's probably no longer useful.
- Tests for
%f
,%g
, or%e
which test functionality that is not tested by moulinette, start withbonus_notrequired_f
, etc. All%f
,%g
, or%e
tests including these can be selected with the wildcard search"bonus*_f_"
, etc. - Tests for rounding have
rnd
in the name. - Tests for
%Lf
start withnotinsubject_f_L
- Tests for the special values of
%f
,%g
, or%e
(such as infinity, NaN, and negative zero) will have_reserved_values_
in the name. -
%f
,%g
, or%e
stress tests will have_stress_
in the name.
- The
notrequired_
andnotmandatory_
tags are otherwise also used either at the start or within the name and are context-dependent with the expectation of being mostly self-explanatory. - Tests that throw a '...flag is ignored when...' warning when you use them with printf will have a
_ignoreflag
in the name. Since this is not undefined behavior per se, they are not necessarily disabled by default. - Tests that throw some other format warning when you use them with printf will have
throwswarning
. They are not necessarily disabled by default. - Tests that may have no defined behavior as per printf(3) will have
undefbehav
in the name. They are explicitly disabled by default.
These naming conventions are usually followed. There's a lot of tests, so making it more consistent will always be an uphill battle. The first rule is the one most users will care about most, and it is consistent.
This is not necessarily a complete list. Test names aim to be descriptive, so that it is clear what the test is testing, as well as organized so that they are selectable. Looking at unit_tests.c, and the show-disabled-tests script are both tools that can help.
See also Enabling and Disabling Tests and querying by Wildcard Search
The moul_
tests were taken from a version of moulinette that was two versions of the subject ago. Do not make the mistake of thinking the moul_
block is the only mandatory one.
- Home
- Installation
- Usage
- What's NOT Covered
- Workflow with PFT
- Options and Configuration
- Additional Features
- Troubleshooting
- Compatibility With Other Systems
- Contributing to this repo (and possible future features)