Changeset 1071:6ca6cadf209c in freeDiameter for tests/testfifo.c
- Timestamp:
- May 2, 2013, 12:22:31 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/testfifo.c
r1060 r1071 217 217 { 218 218 struct fifo * queue = NULL; 219 int count, max;220 219 struct msg * msg = NULL; 220 int max; 221 long long count; 221 222 222 223 /* Create the queue */ … … 224 225 225 226 /* Check the count is 0 */ 226 CHECK( 0, fd_fifo_length(queue, &count, &max) ); 227 CHECK( 0, count); 228 CHECK( 0, max); 227 CHECK( 0, fd_fifo_length(queue) ); 229 228 230 229 /* Now enqueue */ … … 237 236 238 237 /* Check the count is 3 */ 239 CHECK( 0, fd_fifo_length(queue, &count, &max) ); 240 CHECK( 3, count); 241 CHECK( 0, max); 238 CHECK( 3, fd_fifo_length(queue) ); 242 239 243 240 /* Retrieve the first message using fd_fifo_get */ 244 241 CHECK( 0, fd_fifo_get(queue, &msg) ); 245 242 CHECK( msg1, msg); 246 CHECK( 0, fd_fifo_length(queue, &count, NULL) ); 247 CHECK( 2, count); 243 CHECK( 2, fd_fifo_length(queue) ); 248 244 249 245 /* Retrieve the second message using fd_fifo_timedget */ … … 252 248 CHECK( 0, fd_fifo_timedget(queue, &msg, &ts) ); 253 249 CHECK( msg2, msg); 254 CHECK( 0, fd_fifo_length(queue, &count, NULL) ); 255 CHECK( 1, count); 250 CHECK( 1, fd_fifo_length(queue) ); 256 251 257 252 /* Retrieve the third message using meq_tryget */ 258 253 CHECK( 0, fd_fifo_tryget(queue, &msg) ); 259 254 CHECK( msg3, msg); 260 CHECK( 0, fd_fifo_length(queue, &count, NULL) ); 261 CHECK( 0, count); 255 CHECK( 0, fd_fifo_length(queue) ); 262 256 263 257 /* Check that another meq_tryget does not block */ 264 258 CHECK( EWOULDBLOCK, fd_fifo_tryget(queue, &msg) ); 265 CHECK( 0, fd_fifo_length(queue, &count, NULL) ); 266 CHECK( 0, count); 259 CHECK( 0, fd_fifo_length(queue) ); 267 260 268 261 /* Check the timedget actually timesout */ … … 274 267 } 275 268 CHECK( ETIMEDOUT, fd_fifo_timedget(queue, &msg, &ts) ); 276 CHECK( 0, fd_fifo_length(queue, &count, NULL) ); 277 CHECK( 0, count); 269 CHECK( 0, fd_fifo_length(queue) ); 270 271 /* Post & get another message */ 272 msg = msg1; 273 CHECK( 0, fd_fifo_post(queue, &msg) ); 274 CHECK( 0, fd_fifo_timedget(queue, &msg, &ts) ); 275 CHECK( msg1, msg); 276 277 /* Check some statistics */ 278 CHECK( 0, fd_fifo_getstats(queue, NULL, NULL, &max, &count, NULL, NULL, NULL) ); 279 CHECK( 3, max ); 280 CHECK( 4, count ); 278 281 279 282 /* We're done for basic tests */ … … 292 295 pthread_t thr [NBR_THREADS * 2]; 293 296 struct dict_object *dwr_model = NULL; 294 int count;295 297 int i; 296 298 int nbr_threads; … … 363 365 364 366 /* Check the count of the queue is back to 0 */ 365 CHECK( 0, fd_fifo_length(queue, &count, NULL) ); 366 CHECK( 0, count); 367 CHECK( 0, fd_fifo_length(queue) ); 367 368 368 369 /* Destroy this queue and the messages */
Note: See TracChangeset
for help on using the changeset viewer.