Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jan 17, 2024
1 parent 81ae672 commit 3b45dfc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ export function CandidValueAndMetaArbGenerator<
) => fc.Arbitrary<V>,
valueConstraints?: any
): fc.Arbitrary<CandidValueAndMeta<any>> {
return DefinitionArb.chain((candidDefinition) =>
fc.tuple(
return DefinitionArb.chain((candidDefinitionAndShapes) => {
const candidDefinition = candidDefinitionAndShapes.definition;
const recursiveShape = candidDefinitionAndShapes.recursiveShapes;
return fc.tuple(
fc.constant(candidDefinition),
ValueArb(candidDefinition.definition, valueConstraints)
)
).map(
ValueArb(candidDefinition, recursiveShape, valueConstraints)
);
}).map(
([
{
definition: {
candidMeta: {
candidTypeAnnotation,
candidTypeObject,
runtimeCandidTypeObject,
variableAliasDeclarations,
imports
}
candidMeta: {
candidTypeAnnotation,
candidTypeObject,
runtimeCandidTypeObject,
variableAliasDeclarations,
imports
}
},
{ agentArgumentValue, agentResponseValue, valueLiteral }
Expand Down
18 changes: 9 additions & 9 deletions property_tests/arbitraries/candid/recursive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_gen
import { complexCandidDefinitionMemo } from '../candid_definition_arb/complex_candid_definition_memo';
import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../config';

export const recursive: {
shapes: { [key: string]: RecursiveCandidDefinition };
} = {
shapes: {}
};

export type Recursive = any;
export type RecursiveShapes = { [key: string]: RecursiveCandidDefinition };

export function RecursiveArb(): fc.Arbitrary<CandidValueAndMeta<Recursive>> {
return CandidValueAndMetaArbGenerator(
RecursiveDefinitionArb(complexCandidDefinitionMemo, [], {
depthLevel: DEFAULT_DEFINITION_MAX_DEPTH
}),
RecursiveDefinitionArb(
complexCandidDefinitionMemo,
[],
{},
{
depthLevel: DEFAULT_DEFINITION_MAX_DEPTH
}
),
RecursiveValuesArb
);
}

0 comments on commit 3b45dfc

Please sign in to comment.