Skip to content

Commit

Permalink
Merge branch 'main' into 1471_init_method_arb
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann authored Jan 9, 2024
2 parents 3f560c8 + e0b4ef1 commit 17add2b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fc from 'fast-check';
import fc, { sample } from 'fast-check';
import { floatToSrcLiteral } from '../../to_src_literal/float';
import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb';
import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb';
Expand All @@ -23,7 +23,9 @@ export function Float32DefinitionArb(): fc.Arbitrary<FloatCandidDefinition> {
// TODO the agent should encode and decode -0 correctly
export function Float32ValueArb(): fc.Arbitrary<CandidValues<number>> {
return SimpleCandidValuesArb(
fc.float().map((sample) => (sample === 0 ? sample * 0 : sample)),
fc
.float32Array({ maxLength: 1, minLength: 1 })
.map((sample) => (sample[0] === 0 ? sample[0] * 0 : sample[0])),
floatToSrcLiteral
);
}

0 comments on commit 17add2b

Please sign in to comment.