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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
/*
* SCCS: @(#)tciface.c 1.3 (98/08/28)
*
* UniSoft Ltd., London, England
*
* (C) Copyright 1997 X/Open Company Limited
*
* All rights reserved. No part of this source code may be reproduced,
* stored in a retrieval system, or transmitted, in any form or by any
* means, electronic, mechanical, photocopying, recording or otherwise,
* except as stated in the end-user licence agreement, without the prior
* permission of the copyright owners.
* A copy of the end-user licence agreement is contained in the file
* Licence which accompanies this distribution.
*
* X/Open and the 'X' symbol are trademarks of X/Open Company Limited in
* the UK and other countries.
*/
#ifndef lint
static char sccsid[] = "@(#)tciface.c 1.3 (98/08/28) TET3 release 3.3";
#endif
/************************************************************************
SCCS: @(#)tciface.c 1.3 98/08/28 TETware release 3.3
NAME: tciface.c
PRODUCT: TETware
AUTHOR: Andrew Dingwall, UniSoft Ltd.
DATE CREATED: June 1997
DESCRIPTION:
An interface has been defined between the TCM control logic
(which is generic) and the means by which test purposes are
defined and called (which is specific to the C API).
The C TCM uses the functions which constitute this defined
interface when it counts and executes the user-supplied test
purpose functions.
The functions in this file are the defaults that are used when
replacements are not supplied by the user.
These functions implement an interface to the tet_testlist[]
array that is specified for the base TET.
If a user wishes to supply any of the interface functions they
must all be supplied.
The provision of the defined interface make for the following
possibilities:
1) The user may provide replacements for these functions, thus
avoiding the need to specify all the test purposes in a static
array at compile time.
2) When an API is to be implemented in a language which can be
linked with C, (i.e., functions in the other language may call,
and be called from, C functions), it is possible for the new API
to take advantage of all the functionality provided by the
existing C API without having to implement it all from scratch.
This will enable new APIs to be implemented much more easily and,
at the same time, reduce the maintenance overhead associated with
each new API.
The following functions are defined by this interface:
int tet_getmaxic(void)
int tet_getminic(void)
Returns the highest and lowest IC numbers defined in this test
case.
int tet_isdefic(int icnum)
Returns 1 if the specified IC has been defined in this test
case, 0 otherwise.
int tet_gettpcount(int icnum)
Returns the number of TPs that have been defined in the
specified IC.
int tet_gettestnum(int icnum, int tpnum)
Returns the global test number (starting from 1) of the
specified TP within the specified IC.
This function is called by the TCM when the value is to be
assigned to the global variable tet_thistest.
void tet_invoketp(int icnum, int tpnum)
This function is called by the TCM to invoke a particular TP.
The purpose of the return value is reserved for future use.
For now it just returns 0.
MODIFICATIONS:
Andrew Dingwall, UniSoft Ltd., January 1998
Permit the iclist to include IC 0.
************************************************************************/
#include "dtmac.h"
#include "tet_api.h"
/*
** tet_getmaxic(), tet_getminic() - return the highest and lowest
** IC number defined in this test case
*/
int tet_getmaxic()
{
register struct tet_testlist *tp;
register int icmax;
icmax = 0;
for (tp = tet_testlist; tp->testfunc != TET_NULLFP; tp++)
if (tp->icref > icmax)
icmax = tp->icref;
return(icmax);
}
int tet_getminic()
{
register struct tet_testlist *tp;
register int icmin;
icmin = TET_MAX(tet_testlist[0].icref, 0);
for (tp = tet_testlist; tp->testfunc != TET_NULLFP; tp++)
if (tp->icref >= 0 && tp->icref < icmin)
icmin = tp->icref;
return(icmin);
}
/*
** tet_isdefic() - return 1 if the specified IC has been defined
** in this test case, 0 otherwise
*/
int tet_isdefic(icnum)
int icnum;
{
register struct tet_testlist *tp;
for (tp = tet_testlist; tp->testfunc != TET_NULLFP; tp++)
if (tp->icref == icnum)
return(1);
return(0);
}
/*
** tet_gettpcount() - return the number of TPs defined in the
** specified IC
**
** return 0 if the specified IC is not defined in this test case
*/
int tet_gettpcount(icnum)
int icnum;
{
register struct tet_testlist *tp;
register int tpcount;
tpcount = 0;
for (tp = tet_testlist; tp->testfunc != TET_NULLFP; tp++)
if (tp->icref == icnum)
tpcount++;
return(tpcount);
}
/*
** tet_gettestnum() - return the absolute test number (starting
** at 1) for the specified TP within the specified IC
**
** return 0 if the specified TP has not been defined in this test case
*/
int tet_gettestnum(icnum, tpnum)
int icnum, tpnum;
{
register struct tet_testlist *tp;
register int testnum;
testnum = 0;
for (tp = tet_testlist; tp->testfunc != TET_NULLFP; tp++) {
testnum++;
if (tp->icref == icnum && --tpnum == 0)
return(testnum);
}
return(0);
}
/*
** tet_invoketp() - invoke the specified TP within the specified IC
**
** Always returns 0.
*/
int tet_invoketp(icnum, tpnum)
int icnum, tpnum;
{
register struct tet_testlist *tp;
for (tp = tet_testlist; tp->testfunc != TET_NULLFP; tp++)
if (tp->icref == icnum && --tpnum == 0) {
(*tp->testfunc)();
break;
}
return(0);
}
|