Description
Construct synthetic UPC-A cases from four disjoint zero-suppression families plus guaranteed noncompressible controls, delegate check digits and both conversions, and return observed round trips; prefixes must fit every requested family, cases may repeat, and no product allocation is implied.
A protocol fixture is local test data representing headers, messages, identifiers, or request decisions. Serialization and parsing can be checked without contacting a server, while authentication, delivery, and actual client behavior require separate tests.
Construct synthetic UPC-A cases from four disjoint zero-suppression families plus guaranteed noncompressible controls, delegate check digits and both conversions, and return observed round trips; prefixes must fit every requested family, cases may repeat, and no product allocation is implied.
When to use this tool
Use this generator to create reproducible upc compression round trip 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 numberSystem, manufacturerPrefix, families, compressibleCount, noncompressibleCount 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.
Choose one of four disjoint UPC zero-suppression families, complete compatible manufacturer/product digits and delegate check-digit generation and UPC-A/UPC-E conversions. Add requested guaranteed-noncompressible controls, shuffle cases and retain observed round-trip results or actual conversion rejection.1
Delegated operations used for this result: upc a; upc a to upc e. Their calculation or parsing conventions apply to the corresponding result fields.2, 3
| Input field | Meaning and units | Accepted input |
|---|---|---|
| numberSystem | Number System | Required. Text; one of "0", "1". |
| manufacturerPrefix | Manufacturer Prefix | Required. Text; maximum UTF-16 length 5. |
| families | Families | Required. Array of Text; one of "last-digit-0-2", "last-digit-3", "last-digit-4", "last-digit-5-9".; minimum items 1; maximum items 4. |
| compressibleCount | Compressible Count | Required. Safe integer; minimum 0; maximum 64. |
| noncompressibleCount | Noncompressible Count | Required. Safe integer; minimum 0; maximum 64. |
| 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 1; maximum items 128. |
| cases[].family | Family | Required. Text; one of "last-digit-0-2", "last-digit-3", "last-digit-4", "last-digit-5-9", "noncompressible". |
| cases[].manufacturer | Manufacturer | Required. Text; minimum UTF-16 length 5; maximum UTF-16 length 5. |
| cases[].product | Product | Required. Text; minimum UTF-16 length 5; maximum UTF-16 length 5. |
| cases[].upcA | Upc A | Required. Text; minimum UTF-16 length 12; maximum UTF-16 length 12. |
| cases[].conversion | Conversion | Required. Object; no unknown keys. |
| cases[].conversion.compressible | Compressible | Required. Boolean. |
| cases[].conversion.upcE | Upc E | Required. Text; minimum UTF-16 length 8; maximum UTF-16 length 8. or Null. |
| cases[].conversion.expandedUpcA | Expanded Upc A | Required. Text; minimum UTF-16 length 12; maximum UTF-16 length 12. or Null. |
| cases[].conversion.roundTripVerified | Round Trip Verified | Required. Boolean. or Null. |
| 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": {
"numberSystem": "0",
"manufacturerPrefix": "",
"families": [
"last-digit-0-2",
"last-digit-3",
"last-digit-4",
"last-digit-5-9"
],
"compressibleCount": 2,
"noncompressibleCount": 1,
"seed": 42
},
"output": {
"cases": [
{
"family": "last-digit-4",
"manufacturer": "84280",
"product": "00003",
"upcA": "084280000035",
"conversion": {
"compressible": true,
"upcE": "08428345",
"expandedUpcA": "084280000035",
"roundTripVerified": true
}
},
{
"family": "noncompressible",
"manufacturer": "15661",
"product": "58050",
"upcA": "015661580501",
"conversion": {
"compressible": false,
"upcE": null,
"expandedUpcA": null,
"roundTripVerified": null
}
},
{
"family": "last-digit-4",
"manufacturer": "48620",
"product": "00002",
"upcA": "048620000024",
"conversion": {
"compressible": true,
"upcE": "04862244",
"expandedUpcA": "048620000024",
"roundTripVerified": true
}
}
],
"randomness": {
"seed": 42,
"source": "seed"
}
}
} Limitations and assumptions
- The manufacturer prefix must fit every requested family, and at least one case is required. Cases may repeat. Identifiers are synthetic and do not imply a product allocation or registration.
- 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 HTTP Cookie Round-Trip Corpus Generator
Compose bounded synthetic Cookie pairs from validated name/value fragments, select supported canonical/quoted/compact/spaced formatting, and delegate serialization/parsing while preserving duplicate-name order and encoded values; duplicate constraints are construction rules, not browser conformance, live cookies, or secret generation.
- Random Graph Representation Round-Trip Corpus Generator
Generate graphs with optional duplicate listings and delegate edge normalization and matrix round trips, comparing semantic edges independently of listing order.