Home /Modules/advantage/TaUse07RebalanceDistance.expected.txt

TaUse07RebalanceDistance.expected.txt

lib/advantage/trading-actions-on-verb/07-rebalance-distance/TaUse07RebalanceDistance.expected.txt · 24 line(s) · txt

== Use case 7: rebalance distance ==
  ok   distSq to target 1 = 2500
  ok   distSq to target 2 = 2500
  ok   distSq to target 3 = 300
  ok   distance to target 1 (floor) = 50
  ok   distance to target 3 (floor) = 17
  ok   floor property: 17*17 <= 300 < 18*18
  ok   nearestIndex over the three targets (0-based) = 2
  ok   nearestIndex on a tie keeps the first = 0
  ok   nearestIndex with no targets = -1
  ok   nearest target = 3
-- tie norm: targets 1 and 2 are equally far, the first stays --
  ok   tie goes to target 1 = 1
-- rejected input --
  ok   distance beyond the bound = -1
  ok   dimension beyond the bound = -1
  ok   dimension zero = -1
  ok   isqrt of a negative = -1
  ok   isqrt of the largest 32-bit int = 46340
  ok   isqrt above 32 bits = 70710
  ok   isqrt at the exact limit = 94906265
  ok   isqrt just above the exact limit is refused = -1
  checks passed=19 failed=0