From 3846bdf801e4bb4fa5ce05dca7b9dd5f0ddfea00 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Fri, 15 Dec 2023 17:02:28 -0700 Subject: [PATCH] more clean up --- .../candid/candid_definition_arb/index.ts | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/property_tests/arbitraries/candid/candid_definition_arb/index.ts b/property_tests/arbitraries/candid/candid_definition_arb/index.ts index c24f77f70f..3ef3ca86be 100644 --- a/property_tests/arbitraries/candid/candid_definition_arb/index.ts +++ b/property_tests/arbitraries/candid/candid_definition_arb/index.ts @@ -22,17 +22,8 @@ import { VariantDefinitionArb } from '../constructed/variant_arb/definition_arbs import { VecDefinitionArb } from '../constructed/vec_arb/definition_arb'; import { CandidDefinition, - FuncCandidDefinition, - OptCandidDefinition, - RecordCandidDefinition, - TupleCandidDefinition, - VariantCandidDefinition, - VecCandidDefinition, CandidDefinitionArb, - RecursiveGlobalDefinition, - ServiceCandidDefinition, RecursiveCandidDefinition, - RecCandidDefMemo, CandidDefMemo } from './types'; import { BlobDefinitionArb } from '../constructed/blob_arb/definition_arb'; @@ -56,8 +47,11 @@ export function candidDefinitionMemo( return primitiveCandidDefinitionArb(); } return fc.oneof( - primitiveCandidDefinitionArb(), - complexCandidDefinitionMemo(parents)(n - 1), + { arbitrary: primitiveCandidDefinitionArb(), weight: 16 }, + { + arbitrary: complexCandidDefinitionMemo(parents)(n - 1), + weight: 9 + }, { arbitrary: recursiveCandidDefinitionMemo(parents)(n - 1), weight: 1 @@ -70,7 +64,6 @@ export function complexCandidDefinitionMemo( parents: RecursiveCandidDefinition[], constraints: ComplexDefinitionConstraints = {} ): CandidDefMemo { - // TODO Implement constraints return fc.memo((n) => { return fc.oneof( { @@ -100,6 +93,10 @@ export function complexCandidDefinitionMemo( { arbitrary: VecDefinitionArb(candidDefinitionMemo([])(n)), weight: constraints.vec ?? 1 + }, + { + arbitrary: ServiceDefinitionArb(candidDefinitionMemo([])(n)), + weight: constraints.service ?? 0 } ); });