Skip to content
Astera Technology

Match test reads, writes and the shared record

Execute the supplied trace and check whether it represents the requested workload.

Download complete case notes and answer keys ↓

Set the decision and its input

The fictional test recipe requires ten reads and ten writes on recordA. Twenty reads onA have the same operation count but no writes, so the recipe does not match. The programme actually replays read/write operations against a local map and counts both types and touched keys.

Filled local test worksheet
CaseInput JSON
Base test{"requiredReads":10,"requiredWrites":10,"requiredKey":"A","operations":[{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"}]}
Download editable CSV ↓

Run the supplied comparison

This checks benchmark input validity. The replay is sequential and establishes no actual concurrent contention rate, throughput or production capacity; a matched recipe would still need its separate concurrency trial.

Faulty and required outputs
PathOutput JSON
Faulty path{"reads":20,"writes":0,"valueA":0,"testInputMatches":true}
Required path{"reads":20,"writes":0,"valueA":0,"testInputMatches":false}
Download editable CSV ↓
Complete local Node24.14.1 programme
import assert from 'node:assert/strict';

const run=function run(i,corrected=true){
    const values=new Map([['A',0],['B',0]]);let reads=0,writes=0;const keys=new Set();
    for(const op of i.operations){keys.add(op.key);if(op.kind==='read'){values.get(op.key);reads++;}else if(op.kind==='write'){values.set(op.key,values.get(op.key)+1);writes++;}else throw new Error('Outside the fixed operation grammar');}
    const matches=corrected?reads===i.requiredReads&&writes===i.requiredWrites&&keys.size===1&&keys.has(i.requiredKey):reads+writes===i.requiredReads+i.requiredWrites;
    return {reads,writes,valueA:values.get('A'),testInputMatches:matches};
  };
const cases=[{"input":{"requiredReads":10,"requiredWrites":10,"requiredKey":"A","operations":[{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"}]},"corrected":false,"expected":{"reads":20,"writes":0,"valueA":0,"testInputMatches":true}},{"input":{"requiredReads":10,"requiredWrites":10,"requiredKey":"A","operations":[{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"},{"kind":"read","key":"A"}]},"corrected":true,"expected":{"reads":20,"writes":0,"valueA":0,"testInputMatches":false}},{"input":{"requiredReads":1,"requiredWrites":1,"requiredKey":"A","operations":[{"kind":"read","key":"A"},{"kind":"write","key":"A"}]},"corrected":true,"expected":{"reads":1,"writes":1,"valueA":1,"testInputMatches":true}},{"input":{"requiredReads":1,"requiredWrites":1,"requiredKey":"A","operations":[{"kind":"read","key":"B"},{"kind":"write","key":"B"}]},"corrected":true,"expected":{"reads":1,"writes":1,"valueA":0,"testInputMatches":false}}];
for(const test of cases){const actual=await run(test.input,test.corrected);assert.deepEqual(actual,test.expected);console.log(actual);}
Download runnable example ↓

Choose from the boundary evidence

One read/one write onA matches its boundary recipe and leaves A1. The same counts onB leave A0 and fail the required shared-record condition.

  1. Specify transaction mix and key scope
  2. Replay supplied operations
  3. Match counts and touched records

Recipe fit alone is not a performance result.

Editable boundary inputs and outputs
ConditionInput JSONExpected output JSON
required hot-record mix{"requiredReads":1,"requiredWrites":1,"requiredKey":"A","operations":[{"kind":"read","key":"A"},{"kind":"write","key":"A"}]}{"reads":1,"writes":1,"valueA":1,"testInputMatches":true}
same counts but wrong record{"requiredReads":1,"requiredWrites":1,"requiredKey":"A","operations":[{"kind":"read","key":"B"},{"kind":"write","key":"B"}]}{"reads":1,"writes":1,"valueA":0,"testInputMatches":false}
Download editable CSV ↓

Can base twenty-read evidence support the required read/write test?

Show the worked answer

No. Writes are0 rather than10. Equal totals do not establish the required transaction mix or key distribution.

Related resources