pstran robustness: OP where Newton, gmin and source stepping all fail

* (exec-spice "ngspice -b %s")

* Three ideal B v= sources in a high-gain tanh ring.  The nodes are
* forced by voltage sources, so the gmin diagonal augmentation cannot
* damp them; Newton 2-cycles on the steep map and source stepping loses
* the path near full value.  Unique DC solution: all nodes at 0.9 V.
b1 n2 0 v = 0.9 - 0.89*tanh(200*(v(n1)-0.9))
b2 n3 0 v = 0.9 - 0.89*tanh(200*(v(n2)-0.9))
b3 n1 0 v = 0.9 - 0.89*tanh(200*(v(n3)-0.9))
r1 n1 0 1meg

.option pstran

.control

define mismatch(a,b,err) abs(a-b)>err

* keep Newton/gmin/source stepping enabled (they fail on this circuit,
* the ladder must escalate to pstran), but disable optran
optran 1 1 1 0 0 0
op

let fail_count = 0
if mismatch(v(n1), 0.9, 1e-6)
  let v_test = v(n1)
  echo "ERROR, v(n1) = $&v_test but should be 0.9"
  let fail_count = fail_count + 1
end
if mismatch(v(n2), 0.9, 1e-6)
  let v_test = v(n2)
  echo "ERROR, v(n2) = $&v_test but should be 0.9"
  let fail_count = fail_count + 1
end
if mismatch(v(n3), 0.9, 1e-6)
  let v_test = v(n3)
  echo "ERROR, v(n3) = $&v_test but should be 0.9"
  let fail_count = fail_count + 1
end

if fail_count > 0
  echo "ERROR: $&fail_count of 3 tests failed"
  quit 1
else
  echo "INFO: $&fail_count of 3 tests failed"
  quit 0
end

.endc

.end
