JustDummies

Just dummies — but seriously powerful ones.

Documentation sections

JD023: ScalarChainAdmitsNoValue

PropertyValue
CategoryConstraints (JustDummies.Constraints)
Severity🟠 Warning
Enabled by defaultYes

The constant constraints narrow the integer domain to nothing, so the chain throws a ConflictingAnyConstraintException the moment the arrange line runs.

The library computes this with one emptiness test over bounds, lattice and allow-list. This rule runs the same test over the constants written at the call site — and stays silent for every argument it cannot fold.

Noncompliant

Any.Int32().Between(1, 10).MultipleOf(20)     // no multiple of 20 in [1, 10]
Any.Int32().GreaterThan(10).LessThan(3)       // empty interval
Any.Int32().Positive().Negative()             // empty by construction
Any.Int32().Zero().NonZero()                  // the only value left is then forbidden
Any.Int32().OneOf(5).Except(5)                // the allow-list is emptied

Compliant

Any.Int32().Between(1, 10).MultipleOf(5)
Any.Int32().GreaterThan(-100).LessThan(100)
Any.Int32().OneOf(1, 2, 3).Except(2)

Scope, and one boundary worth knowing

Integer generators onlyInt32, Int16, Int64, Byte, SByte, UInt16, UInt32, UInt64. The model is integer arithmetic, and a floating-point or decimal domain does not behave like one.

Bounds run to the representable extremes. Any.Int64().LessThanOrEqualTo(long.MinValue) is a legal chain that yields exactly one value, and is not reported; only a bound asking for something genuinely beyond the range — GreaterThan(long.MaxValue) — empties the domain. The first version of this rule got that wrong, using -long.MaxValue as its “unbounded” sentinel, which made long.MinValue unrepresentable and condemned a chain the library’s own suite asserts is legal.

The model reasons in long, which every value of the other seven families fits. A ulong above long.MaxValue does not, so it is left unjudged rather than truncated into a bound meaning something else.

What it does not flag

  • A chain with any argument that does not fold to a constant.
  • A UInt64 bound above long.MaxValue — outside the model’s range, so the chain is left alone.
  • A chain split across statements — it must be one expression.
  • A constraint the model does not track: the walk ends rather than guessing.
  • A conflict-asserting negative test.

Read the source, or correct it there opens in a new tab· Mirrored from lib-v1.0.0-preview.6