#!/bin/sh
#
# Test results last captured at "Wed Mar  9 19:48:10 PST 2005"
#
# This is an IBIS icm test program
#
# It is a self-contained package of all of the 
# files and data required to run an icm parser test.
#
# Usage:  ./test_010  <arg>
#
# <nothing>               = Run the test silently in GNU check mode
# "Brief"                 = Run the test.
#                           If there is no error, produce a one line summary
#                           Otherwise, produce a full test report.
# "Full"                  = Run the test and always produce a full test report
# "Capture"               = Capture test results and REWRITE the test program
# "Extract"               = Extract the .icm and .out files
#

Test=`basename $0`
Synopsis="[key  word] and [key__word] are illegal"
ExitStatus="1"
Counters="ERRORS: 32 WARNINGS: 2"
ExtraFiles="test_model_1.jpg"

Description=`grep -v '^EOF$' <<'EOF'
This file confirms that [keywords] only permit single spaces or underscores
between words within the keyword.

Errors are expected.
EOF`

Output=`grep -v '^EOF$' <<'EOF'
IBIS ICM Parser, version 1.1.0
ERROR (Line 29/Col 1) Unknown keyword '[Redistribution  Text]'.
ERROR (Line 29/Col 66) Orphaned line.
ERROR (Line 56/Col 1) Unknown keyword '[Begin _ICM Model]'.
ERROR (Line 56/Col 30) Orphaned line.
ERROR (Line 57/Col 27) Orphaned line.
ERROR (Line 58/Col 8) Orphaned line.
ERROR (Line 60/Col 1) syntax error, unexpected TREE_PATH_DESCRIPTION
ERROR (Line 61/Col 3) syntax error, unexpected Model_pinmap
ERROR (Line 62/Col 3) syntax error, unexpected Section
ERROR (Line 63/Col 3) syntax error, unexpected Model_pinmap
ERROR (Line 65/Col 1) syntax error, unexpected END_ICM_MODEL
ERROR (Line 68/Col 1) All [Begin ICM Model] keywords expected before this point.
ERROR (Line 77/Col 1) All [Begin ICM Model] keywords expected before this point.
ERROR (Line 47/Col 4) Model 'TestModel1' was not defined by a [Begin ICM Model] keyword.
ERROR (Line 92/Col 1) Unknown keyword '[Begin ICM__Section]'.
ERROR (Line 92/Col 27) Orphaned line.
ERROR (Line 93/Col 1) syntax error, unexpected DERIVATION_METHOD
ERROR (Line 93/Col 27) Orphaned line.
ERROR (Line 94/Col 1) syntax error, unexpected RESISTANCE_MATRIX
ERROR (Line 94/Col 36) Orphaned line.
ERROR (Line 95/Col 8) Orphaned line.
ERROR (Line 96/Col 7) Orphaned line.
ERROR (Line 97/Col 1) syntax error, unexpected INDUCTANCE_MATRIX
ERROR (Line 97/Col 36) Orphaned line.
ERROR (Line 98/Col 6) Orphaned line.
ERROR (Line 99/Col 7) Orphaned line.
ERROR (Line 100/Col 1) syntax error, unexpected CAPACITANCE_MATRIX
ERROR (Line 100/Col 37) Orphaned line.
ERROR (Line 101/Col 6) Orphaned line.
ERROR (Line 102/Col 8) Orphaned line.
ERROR (Line 103/Col 1) syntax error, unexpected END_ICM_SECTION
ERROR (Line 103/Col 24) Orphaned line.
WARNING (Line 68/Col 1) Pin Map 'Port1' was defined but not used.
WARNING (Line 77/Col 1) Pin Map 'Port2' was defined but not used.
Finished. ERRORS: 32 WARNINGS: 2
EOF`

ICM=`grep -v '^EOF$' <<'EOF'

|**********************************************************************
[Begin Header]
[ICM Ver]             1.0
[File Name]           test_010.icm
[File Rev]            0.1
[Date]                October 8, 2003

[Source]              Kelly C. Green

[Notes]               This is the minimum correct file

                      It will be used as a basis for systematic
                      feature tests

[Disclaimer]          No license, express or implied, by estoppel or
                      otherwise, to any intellectual property rights is 
                      granted by this document. 

                      No warranty of any kind.  No support of any kind.
                      Use this file entirely at your own risk.

[Copyright]           None - public domain
[Support]             http://www.vhdl.org/pub/ibis/
[Redistribution]      Yes    

| error two spaces

[Redistribution  Text] You may do anything you wish to this file.
[End Header]

|**********************************************************************
|
[Comment Char] |_char
|
|**********************************************************************

[Begin ICM Family]        Template test file
[Manufacturer]            None
[ICM Family Description]  This file is a template from which most 
                          subsequent test files will be derived.

|**********************************************************************
[ICM Model List] 
|  Name             Mating   Min_Slew_Time   Image
|
   TestModel1       Mated    100ps           test_model_1.jpg
|
|          SectA
| Port1 >---------< Port2
|
|**********************************************************************

|error space and underscore

[Begin _ICM Model] TestModel1
ICM_model_type SLM_general
SGR 1:1
|
[Tree Path Description]
  Model_pinmap Port1
  Section Mult=1 SectA
  Model_pinmap Port2
|
[End ICM Model]
|
|**********************************************************************
[ICM Pin Map] Port1
Pin_order Row_ordered
Num_of_rows = 1
Num_of_columns = 2
Pin_list
|Pin Name
A1 SIG1_IN
A2 SIG2_IN

[ICM Pin Map] Port2
Pin_order Row_ordered
Num_of_rows = 1
Num_of_columns = 2
Pin_list
|Pin Name
B1 SIG1_OUT
B2 SIG2_OUT

[End ICM Family]
|
|**********************************************************************

| error two underscores

[Begin ICM__Section] SectA
[Derivation Method] Lumped
[Resistance Matrix] Diagonal_matrix
1.0mohm
1.0e-3
[Inductance Matrix] Diagonal_matrix
4.0nh
4.0e-9
[Capacitance Matrix] Diagonal_matrix
2.0pf
2.0e-12
[End ICM Section] SectA

|**********************************************************************
[End]
|**********************************************************************
EOF`

#
# we are either running the test directly in the test directory
# or are running make check.  make sets the srcdir variable
# so we can tell the difference easily
#

if [ -z "${srcdir}" ]
then
    srcdir="."
    exedir="../../src"
else
    srcdir="${srcdir}/v_1_0"
    exedir="../src"
fi

export srcdir exedir Test Synopsis ExitStatus Counters ExtraFiles Description Output ICM

exec ${srcdir}/run_test "$@"
