Skip to content

Main content

Random UPC Compression Round-Trip Corpus Generator

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.

Loading tool…

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

  1. Supply numberSystem, manufacturerPrefix, families, compressibleCount, noncompressibleCount in the field shapes below. Set seed when you need an explicit replay.
  2. 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.
  3. 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 fieldMeaning and unitsAccepted input
numberSystemNumber SystemRequired. Text; one of "0", "1".
manufacturerPrefixManufacturer PrefixRequired. Text; maximum UTF-16 length 5.
familiesFamiliesRequired. 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.
compressibleCountCompressible CountRequired. Safe integer; minimum 0; maximum 64.
noncompressibleCountNoncompressible CountRequired. Safe integer; minimum 0; maximum 64.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
casesCasesRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 128.
cases[].familyFamilyRequired. Text; one of "last-digit-0-2", "last-digit-3", "last-digit-4", "last-digit-5-9", "noncompressible".
cases[].manufacturerManufacturerRequired. Text; minimum UTF-16 length 5; maximum UTF-16 length 5.
cases[].productProductRequired. Text; minimum UTF-16 length 5; maximum UTF-16 length 5.
cases[].upcAUpc ARequired. Text; minimum UTF-16 length 12; maximum UTF-16 length 12.
cases[].conversionConversionRequired. Object; no unknown keys.
cases[].conversion.compressibleCompressibleRequired. Boolean.
cases[].conversion.upcEUpc ERequired. Text; minimum UTF-16 length 8; maximum UTF-16 length 8. or Null.
cases[].conversion.expandedUpcAExpanded Upc ARequired. Text; minimum UTF-16 length 12; maximum UTF-16 length 12. or Null.
cases[].conversion.roundTripVerifiedRound Trip VerifiedRequired. Boolean. or Null.
randomnessReplay 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.seedOptional numeric replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. 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.

json
{
  "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

  1. Tool behavior and example: Random UPC Compression Round-Trip Corpus Generator — tool.io

  2. Calculation or validation: generate/upc-a — tool.io

  3. Calculation or validation: convert/upc-a-to-upc-e — tool.io

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.