Description
Generate unit, percentage, and feet-and-inches spellings with malformed controls and delegated normalized values without unit conversion.
A parser corpus pairs literal input spellings or structured documents with observable parser results or explicitly constructed expectations. Successful parsing, semantic validity, and exact round-trip preservation are separate properties, so test records retain the relevant evidence.
Generate unit, percentage, and feet-and-inches spellings with malformed controls and delegated normalized values without unit conversion.
When to use this tool
Use this generator to create reproducible quantity parsing corpus cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.
How to use the tool and how it works
- Supply units, minimumWhole, maximumWhole, count in the field shapes below. Set seed when you need an explicit replay.
- Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
- Read cases. Use the conventions below and keep answer-bearing fields separate when presenting an exercise.
Draw a whole part, decimal digit, and supported unit. For each draw, create six quantity, percentage, and feet/inches strings including malformed controls; retain actual acceptance, parsed value, and unit from the existing parsers.1
Delegated operations used for this result: quantity; percentage. Their calculation or parsing conventions apply to the corresponding result fields.2, 3
| Input field | Meaning and units | Accepted input |
|---|---|---|
| units | Units | Required. Array of Text; minimum UTF-16 length 1; maximum UTF-16 length 64.; minimum items 1; maximum items 128. |
| minimumWhole | Minimum Whole | Required. Safe integer; minimum 0. |
| maximumWhole | Maximum Whole | Required. Safe integer; minimum 0. |
| count | Requested count; the mechanics explain whether one draw expands into several returned records. | Required. Safe integer; minimum 1; maximum 128. |
| seed | Optional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed. | Optional. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| cases | Cases | Required. Array of Object; no unknown keys.; minimum items 6; maximum items 768. |
| cases[].kind | Kind | Required. Text; one of "quantity", "percentage", "feet-and-inches". |
| cases[].control | Control | Required. Boolean. |
| cases[].text | Text | Required. Text; maximum UTF-16 length 4096. |
| cases[].accepted | Accepted | Required. Boolean. |
| cases[].value | Value | Required. Finite number. or Null. |
| cases[].unit | Unit | Required. Text; maximum UTF-16 length 4096. |
| randomness | Replay metadata: source is seed or context; seed is the normalized 32-bit seed or null for a context source. | Required. Object; no unknown keys. |
| randomness.seed | Optional numeric replay seed; normalization and precedence are explained below. | Required. Safe integer. or Null. |
| randomness.source | Source | Required. Text; one of "context", "seed". |
An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.
{
"input": {
"units": [
"kg",
"m/s"
],
"minimumWhole": 0,
"maximumWhole": 99,
"count": 1,
"seed": 42
},
"output": {
"cases": [
{
"kind": "quantity",
"control": false,
"text": "60.4 m/s",
"accepted": true,
"value": 60.4,
"unit": "m/s"
},
{
"kind": "quantity",
"control": true,
"text": "60.4",
"accepted": false,
"value": null,
"unit": ""
},
{
"kind": "percentage",
"control": false,
"text": "60.4%",
"accepted": true,
"value": 0.604,
"unit": "fraction"
},
{
"kind": "percentage",
"control": true,
"text": "60.4%x",
"accepted": false,
"value": null,
"unit": "fraction"
},
{
"kind": "feet-and-inches",
"control": false,
"text": "60 ft 4 in",
"accepted": true,
"value": 724,
"unit": "in"
},
{
"kind": "feet-and-inches",
"control": true,
"text": "60 ft x in",
"accepted": false,
"value": null,
"unit": "in"
}
],
"randomness": {
"seed": 42,
"source": "seed"
}
}
} Limitations and assumptions
- count yields six cases. Percentage values are fractions and feet/inches values are total inches. Units are parsed labels rather than dimensional conversions; the supported grammar remains the linked parsers' grammar.
- A replay requires the same complete input and implementation. Randomized construction does not guarantee uniform coverage of every feasible output; finite samples can repeat unless a distinct-selection rule is explicitly stated.
- The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.
Alternative or Complementary methods
For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.
References
Similar or alternative tools
- Random Identifier Transcription Error Corpus Generator
Generate synthetic checksum-valid EAN-13 and 978-prefixed ISBN-13 originals, apply a selected decimal substitution, deletion, or adjacent transposition, and record actual GTIN/ISBN validator outcomes; swaps may be unchanged or remain valid, and checksum validity is not product or publication allocation.
- Random JSON Duplicate ID Dataset Generator
Construct linked records with an exact duplicate insertion count and retain missing, unique and ambiguous reference candidate indices.