pstran consistency: forced pstran must reproduce the plain Newton OP

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

v1 in 0 5
r1 in mid 1k
d1 mid 0 dmod
r2 mid out 2k
c1 out 0 1n
r3 out 0 10k
.model dmod d(is=1e-14 n=1.5)

.option pstran

.control

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

* plain Newton converges directly; pstran is never reached
op
let mid_gold = v(mid)
let out_gold = v(out)

* now disable Newton, gmin stepping, source stepping and optran:
* the pseudo-transient continuation is the only method left
optran 0 0 0 0 0 0
op

let fail_count = 0
if mismatch(v(mid), mid_gold, 1e-6)
  let v_test = v(mid)
  echo "ERROR, v(mid) = $&v_test but should be $&mid_gold"
  let fail_count = fail_count + 1
end
if mismatch(v(out), out_gold, 1e-6)
  let v_test = v(out)
  echo "ERROR, v(out) = $&v_test but should be $&out_gold"
  let fail_count = fail_count + 1
end

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

.endc

.end
