Skip to content

Main content

Random Debounce Signal Test Case Generator

Generate intended Boolean transitions with seeded bounded old/new-state bounce prefixes and explicit stable holds/sample times, then delegate consecutive-sample debouncing; retain clean/raw/filtered signals, detected edges, and mismatch counts without promising that filtering reconstructs the clean signal or qualifies hardware.

Loading tool…

Description

Generate intended Boolean transitions with seeded bounded old/new-state bounce prefixes and explicit stable holds/sample times, then delegate consecutive-sample debouncing; retain clean/raw/filtered signals, detected edges, and mismatch counts without promising that filtering reconstructs the clean signal or qualifies hardware.

An operation trace pairs an ordered request stream with the state after each step. Empty operations, ties, evictions, and boundary indexes are part of the modeled contract rather than incidental display details.

Generate intended Boolean transitions with seeded bounded old/new-state bounce prefixes and explicit stable holds/sample times, then delegate consecutive-sample debouncing; retain clean/raw/filtered signals, detected edges, and mismatch counts without promising that filtering reconstructs the clean signal or qualifies hardware.

When to use this tool

Use this generator to create reproducible debounce signal test case 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 initial, transitionCount, initialHoldSamples, stableHoldSamples, maximumBounceSamples, oldStateProbability, requiredSamples, samplePeriodMilliseconds 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 samplePeriodMilliseconds, timesMilliseconds, clean, raw, filtered, intendedTransitions, detectedTransitions, mismatchCounts. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.

Construct alternating intended Boolean transitions with a sampled bounce segment and stable hold after each. Generate raw samples and ideal clean states, delegate a consecutive-sample debounce filter, and return detected transitions and mismatch counts against clean.1

Delegated operations used for this result: debounce filter. Their calculation or parsing conventions apply to the corresponding result fields.2

Input fieldMeaning and unitsAccepted input
initialInitialRequired. Boolean.
transitionCountTransition CountRequired. Safe integer; minimum 1; maximum 32.
initialHoldSamplesInitial Hold SamplesRequired. Safe integer; minimum 0; maximum 128.
stableHoldSamplesStable Hold SamplesRequired. Safe integer; minimum 1; maximum 128.
maximumBounceSamplesMaximum Bounce SamplesRequired. Safe integer; minimum 0; maximum 32.
oldStateProbabilityOld State ProbabilityRequired. Finite number; minimum 0; maximum 1.
requiredSamplesConsecutive samples required for a state change.Required. Safe integer; minimum 1; maximum 100000.
samplePeriodMillisecondsSample Period MillisecondsRequired. Finite number; strictly above 0.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
samplePeriodMillisecondsSample Period MillisecondsRequired. Finite number; strictly above 0.
timesMillisecondsTimes MillisecondsRequired. Array of Finite number; minimum 0.; minimum items 1; maximum items 4096.
cleanCleanRequired. Array of Boolean.; minimum items 1; maximum items 4096.
rawRawRequired. Array of Boolean.; minimum items 1; maximum items 4096.
filteredFilteredRequired. Array of Boolean.; minimum items 1; maximum items 4096.
intendedTransitionsIntended TransitionsRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 32.
intendedTransitions[].startIndexStart IndexRequired. Safe integer; minimum 0; maximum 4095.
intendedTransitions[].stableStartIndexStable Start IndexRequired. Safe integer; minimum 0; maximum 4095.
intendedTransitions[].bounceSamplesBounce SamplesRequired. Safe integer; minimum 0; maximum 32.
intendedTransitions[].targetStateTarget StateRequired. Boolean.
detectedTransitionsDetected TransitionsRequired. Array of Object; no unknown keys.; maximum items 4096.
detectedTransitions[].indexIndexRequired. Safe integer; minimum 0; maximum 4095.
detectedTransitions[].timeMillisecondsTime MillisecondsRequired. Finite number; minimum 0.
detectedTransitions[].stateStateRequired. Boolean.
mismatchCountsMismatch CountsRequired. Object; no unknown keys.
mismatchCounts.rawVersusCleanRaw Versus CleanRequired. Safe integer; minimum 0; maximum 4096.
mismatchCounts.filteredVersusCleanFiltered Versus CleanRequired. Safe integer; minimum 0; maximum 4096.
randomnessReplay source and normalized 32-bit seed, or null seed for an advancing context source.Required. Object; no unknown keys.
randomness.seedOptional safe-integer 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": {
    "initial": false,
    "transitionCount": 2,
    "initialHoldSamples": 2,
    "stableHoldSamples": 3,
    "maximumBounceSamples": 2,
    "oldStateProbability": 0.5,
    "requiredSamples": 2,
    "samplePeriodMilliseconds": 10,
    "seed": 42
  },
  "output": {
    "samplePeriodMilliseconds": 10,
    "timesMilliseconds": [
      0,
      10,
      20,
      30,
      40,
      50,
      60,
      70,
      80,
      90,
      100
    ],
    "clean": [
      false,
      false,
      true,
      true,
      true,
      true,
      false,
      false,
      false,
      false,
      false
    ],
    "raw": [
      false,
      false,
      false,
      true,
      true,
      true,
      false,
      true,
      false,
      false,
      false
    ],
    "filtered": [
      false,
      false,
      false,
      false,
      true,
      true,
      true,
      true,
      true,
      false,
      false
    ],
    "intendedTransitions": [
      {
        "startIndex": 2,
        "stableStartIndex": 3,
        "bounceSamples": 1,
        "targetState": true
      },
      {
        "startIndex": 6,
        "stableStartIndex": 8,
        "bounceSamples": 2,
        "targetState": false
      }
    ],
    "detectedTransitions": [
      {
        "index": 4,
        "timeMilliseconds": 40,
        "state": true
      },
      {
        "index": 9,
        "timeMilliseconds": 90,
        "state": false
      }
    ],
    "mismatchCounts": {
      "rawVersusClean": 2,
      "filteredVersusClean": 5
    },
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • Debouncing can delay transitions and may increase some sample-by-sample mismatches. Time spacing must remain finite and strictly increasing. This is a discrete signal fixture rather than tested electrical hardware or safety control.
  • A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
  • 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 Debounce Signal Test Case Generator — tool.io

  2. Calculation or validation: microcontroller/debounce-filter — tool.io

Similar or alternative tools

  • Two-Table Cuckoo Hashing Trace Tool

    Trace insertion evictions, lookups and deletion in two fixed-size integer-key cuckoo tables using h1(k)=k mod m and h2(k)=floor(k/m) mod m; a kick limit rolls back the insertion and signals rehash-needed, without automatic resizing or hash-quality guarantees.

  • Random Binary Search Boundary Corpus Generator

    Generate a sorted integer array with a present query, absent endpoint controls and caller targets, retaining exact binary lower/upper indices cross-checked against frequency counts.