1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 06:29:42 +02:00

b2/test/inv: inventory database test

This commit is contained in:
Werner Almesberger 2012-06-02 14:32:41 -03:00
parent e62bb067f7
commit cc5d9a9d58

84
b2/test/inv Executable file
View File

@ -0,0 +1,84 @@
#!/bin/bash
. ./Common
###############################################################################
tst "inventory: one item" <<EOF
; /* no hierarchy */
!-x
USD
!-i
FOO R101X CT 1234 1 USD 0 1 0.1 10 0.8 100 6
EOF
# provider name categ stock units/pkg curr add qty price ...
expect <<EOF
FOO R101X
FOO CT 1234 1 USD 0 1 0.1 10 0.8 100 6
EOF
#------------------------------------------------------------------------------
tst "inventory: two items" <<EOF
; /* no hierarchy */
!-x
USD
!-i
FOO R101X CT 1234 1 USD 0 1 0.1 10 0.8 100 6
FOO R101X-T TR 1234 3000 USD 0 3000 13
EOF
expect <<EOF
FOO R101X-T
FOO TR 1234 3000 USD 0 3000 13
FOO R101X
FOO CT 1234 1 USD 0 1 0.1 10 0.8 100 6
EOF
#------------------------------------------------------------------------------
tst "inventory: two files" <<EOF
; /* no hierarchy */
!-x
USD
!-i1
FOO R101X CT 1234 1 USD 0 1 0.1 10 0.8 100 6
!-i2
FOO R101X-T TR 1234 3000 USD 0 3000 13
EOF
expect <<EOF
FOO R101X
FOO CT 1234 1 USD 0 1 0.1 10 0.8 100 6
FOO R101X-T
FOO TR 1234 3000 USD 0 3000 13
EOF
#------------------------------------------------------------------------------
tst_fail "inventory: duplicate item" <<EOF
; /* no hierarchy */
!-x
USD
!-i
FOO R101X CT 1234 1 USD 0 1 0.1 10 0.8 100 6
FOO R101X CT 1234 1 USD 0 1 0.1 10 0.8 100 6
EOF
expect <<EOF
i:3: part FOO R101X already has stock
EOF
#------------------------------------------------------------------------------
tst_fail "inventory: unknown currency" <<EOF
; /* no hierarchy */
!-i
FOO R101X-T TR 1234 3000 EUR 0 3000 10.4
EOF
expect <<EOF
i:2: unknown currency EUR
EOF
###############################################################################