1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-04 23:05:21 +02:00

b2/test/char: part characteristics database test

This commit is contained in:
Werner Almesberger 2012-06-02 05:55:28 -03:00
parent ea5732371d
commit dd727b1a8c

108
b2/test/char Executable file
View File

@ -0,0 +1,108 @@
#!/bin/bash
. ./Common
###############################################################################
tst "characteristics: one file" -dc <<EOF
<T> = R;
<FP> = 0402<0603<0805;
{ FP=<FP> }
T=<T> {
R: { R=#R TOL=%R };
};
!-c
FOO BAR1 T=R FP=0603 R=100R TOL=5%
FOO BAR2 T=R FP=0603 R=1k TOL=1%
EOF
expect <<EOF
FOO BAR1
FP=0603 T=R R=100R TOL=-5/+5%
FOO BAR2
FP=0603 T=R R=1000R TOL=-1/+1%
EOF
#------------------------------------------------------------------------------
tst "characteristics: two files" -dc <<EOF
<T> = R;
<FP> = 0402<0603<0805;
{ FP=<FP> }
T=<T> {
R: { R=#R TOL=%R };
};
!-c1
FOO BAR1 T=R FP=0603 R=100R TOL=5%
FOO BAR2 T=R FP=0603 R=1k TOL=1%
!-c2
FOO BAR3 T=R FP=0402 R=100R TOL=2%
EOF
expect <<EOF
FOO BAR1
FP=0603 T=R R=100R TOL=-5/+5%
FOO BAR2
FP=0603 T=R R=1000R TOL=-1/+1%
FOO BAR3
FP=0402 T=R R=100R TOL=-2/+2%
EOF
#------------------------------------------------------------------------------
tst_fail "characteristics: duplicate part" -dc <<EOF
<T> = R;
<FP> = 0402<0603<0805;
{ FP=<FP> }
T=<T> {
R: { R=#R TOL=%R };
};
!-c
FOO BAR1 T=R FP=0603 R=100R TOL=5%
FOO BAR1 T=R FP=0603 R=1k TOL=1%
EOF
expect <<EOF
c:3: FOO BAR1 parameters already defined
EOF
#------------------------------------------------------------------------------
tst_fail "characteristics: invalid/unknown value" -dc <<EOF
<T> = R;
<FP> = 0402<0603<0805;
{ FP=<FP> }
T=<T> {
R: { R=#R TOL=%R };
};
!-c
FOO BAR1 T=R FP=0603 R=100R TOL=5%
FOO BAR2 T=R FP=0603 R=1uF
EOF
expect <<EOF
c:3: invalid value for R
EOF
#------------------------------------------------------------------------------
tst "characteristics: unknown parameter" -dc <<EOF
<T> = R;
<FP> = 0402<0603<0805;
{ FP=<FP> }
T=<T> {
R: { R=#R TOL=%R };
};
!-c
FOO BAR1 T=R FP=0603 R=100R TOL=5%
FOO BAR2 T=R FP=0603 R=1k TOL=1% BLAH=3
EOF
expect <<EOF
c:3: warning: extra parameter: BLAH
FOO BAR1
FP=0603 T=R R=100R TOL=-5/+5%
FOO BAR2
FP=0603 T=R R=1000R TOL=-1/+1%
EOF
###############################################################################