#!/usr/bin/env perl

#use lib '.';
use XyceRegression::Tools;
use XdmCommon;

#$Tools = XyceRegression::Tools->new();
#$Tools->setDebug(1);

# The input arguments to this script are set up in 
# Xyce_Test/TestScripts/tsc_run_test_suite and are as follows:
# $ARGV[0] = location of Xyce binary
# $ARGV[1] = location of xyce_verify.pl script
# $ARGV[2] = location of compare script  (This is NEVER used and can be ignored)
# $ARGV[3] = location of circuit file to test
# $ARGV[4] = location of gold standard prn file

use Getopt::Long;
&GetOptions( "verbose!" => \$verbose );
$XYCE=$ARGV[0];
#$XYCE_VERIFY=$ARGV[1];
$CIRFILE=$ARGV[3]; 
#$GOLDPRN=$ARGV[4];

# these are the tolerances used in comparing the measures calculated by this 
# script to those calculated by Xyce.  Zerotol is needed because some measured
# values should be zero (and reltol won't make sense in that case).
$absTol = 1.0e-5;
$relTol = 1.0e-3;
$zeroTol = 1.0e-10;

# Note: must escape ( ) and * with \\ to get the CheckError() function to work.
# Do not have to escape { } or _.
@searchstrings = (
  "Could not accept .OPTIONS",
  "Could not accept .OPTIONS",
  "Could not accept .OPTIONS",
  "Could not accept .OPTIONS",
  "ELAPLACE bogo_node 0 LAPLACE {V\\(10\\)} = {1/\\(1\\+.001\\*s\\)}; Retained \\(as a comment\\). Continuing.",
  "EFREQ bogo_node 0 FREQ {V\\(10\\)}=\\(0,0,0\\)\\(5kHz, 0,0\\)\\(6kHz -60, 0\\) DELAY=3.2ms; Retained \\(as a comment\\). Continuing.",
  "ECHEB bogo_node 0 CHEBYSHEV {V\\(10\\)} = LP 800 1.2K .1dB 50dB; Retained \\(as a comment\\). Continuing.",
  "GLAPLACE bogo_node 0 LAPLACE {V\\(10\\)} = {1/\\(1\\+.001\\*s\\)}; Retained \\(as a comment\\). Continuing.",
  "GFREQ bogo_node 0 FREQ {V\\(10\\)}=\\(0,0,0\\)\\(5kHz, 0,0\\)\\(6kHz -60, 0\\) DELAY=3.2ms; Retained \\(as a comment\\). Continuing.",
  "GCHEB bogo_node 0 CHEBYSHEV {V\\(10\\)} = LP 800 1.2K .1dB 50dB; Retained \\(as a comment\\). Continuing."
);
$searchStringsPtr=\@searchstrings;

XdmCommon::verifyXDMtranslation($XYCE,$XYCE_VERIFY,$CIRFILE,$absTol,$relTol,$zeroTol,
                                $verbose,$searchStringsPtr);
