File: tests

package info (click to toggle)
pcx 1.1.10-4
  • links: PTS
  • area: non-free
  • in suites: sarge
  • size: 1,636 kB
  • ctags: 1,127
  • sloc: ansic: 17,648; sh: 212; makefile: 150; csh: 48
file content (132 lines) | stat: -rw-r--r-- 4,651 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/sh
#
# This is a simple script that tests pcx
#
# install as: /usr/lib/debian-test/tests/pcx
# or else as: /usr/lib/debian-test/tests/pcx/test-1
# In the latter case, /usr/lib/debian-test/tests/pcx/ can contain
# other file with test data and/or other scripts named test-2, test-3, etc.
#
# You can run this script with the command
#       sh debian/tests
# After installation, you can run it with the commands
#       /usr/lib/debian-test/tests/pcx
# or
#       debian-test -v pcx
# see debian-test(1)

. ${DEBIANTEST_LIB:-/usr/lib/debian-test/lib}/functions.sh

if [ -f my-data-file ]; then
    TESTDIR=`pwd`;
else
    TESTDIR=/usr/lib/debian-test/tests/pcx;
fi


## We need a scratch directory in which to execute

TMP=/tmp/pcx-test.$$
test -e $TMP && rm -rf $TMP
mkdir $TMP
cd $TMP
trap "rm -rf $TMP" EXIT

test1(){
    RESULT=0
# This is one of the examples shipped with pcx
    cat >afiro.mps <<EOF
NAME          AFIRO                                                  
ROWS
 E  R09     
 E  R10     
 L  X05     
 L  X21     
 E  R12     
 E  R13     
 L  X17     
 L  X18     
 L  X19     
 L  X20     
 E  R19     
 E  R20     
 L  X27     
 L  X44     
 E  R22     
 E  R23     
 L  X40     
 L  X41     
 L  X42     
 L  X43     
 L  X45     
 L  X46     
 L  X47     
 L  X48     
 L  X49     
 L  X50     
 L  X51     
 N  COST    
COLUMNS
    X01       X48               .301   R09                -1.   
    X01       R10              -1.06   X05                 1.   
    X02       X21                -1.   R09                 1.   
    X02       COST               -.4   
    X03       X46                -1.   R09                 1.   
    X04       X50                 1.   R10                 1.   
    X06       X49               .301   R12                -1.   
    X06       R13              -1.06   X17                 1.   
    X07       X49               .313   R12                -1.   
    X07       R13              -1.06   X18                 1.   
    X08       X49               .313   R12                -1.   
    X08       R13               -.96   X19                 1.   
    X09       X49               .326   R12                -1.   
    X09       R13               -.86   X20                 1.   
    X10       X45              2.364   X17                -1.   
    X11       X45              2.386   X18                -1.   
    X12       X45              2.408   X19                -1.   
    X13       X45              2.429   X20                -1.   
    X14       X21                1.4   R12                 1.   
    X14       COST              -.32   
    X15       X47                -1.   R12                 1.   
    X16       X51                 1.   R13                 1.   
    X22       X46               .109   R19                -1.   
    X22       R20               -.43   X27                 1.   
    X23       X44                -1.   R19                 1.   
    X23       COST               -.6   
    X24       X48                -1.   R19                 1.   
    X25       X45                -1.   R19                 1.   
    X26       X50                 1.   R20                 1.   
    X28       X47               .109   R22               -.43   
    X28       R23                 1.   X40                 1.   
    X29       X47               .108   R22               -.43   
    X29       R23                 1.   X41                 1.   
    X30       X47               .108   R22               -.39   
    X30       R23                 1.   X42                 1.   
    X31       X47               .107   R22               -.37   
    X31       R23                 1.   X43                 1.   
    X32       X45              2.191   X40                -1.   
    X33       X45              2.219   X41                -1.   
    X34       X45              2.249   X42                -1.   
    X35       X45              2.279   X43                -1.   
    X36       X44                1.4   R23                -1.   
    X36       COST              -.48   
    X37       X49                -1.   R23                 1.   
    X38       X51                 1.   R22                 1.   
    X39       R23                 1.   COST               10.   
RHS
    B         X50               310.   X51               300.   
    B         X05                80.   X17                80.   
    B         X27               500.   R23                44.   
    B         X40               500.   
ENDATA
EOF
    if PCx afiro.mps | grep -q "Primal Objective = -4.647531" ; then 
	true; 
    else 
	RESULT=1; 
    fi
    return $RESULT
}

runtest "afiro" test1