~ubuntu-branches/ubuntu/vivid/ncbi-tools6/vivid-proposed

« back to all changes in this revision

Viewing changes to connect/test/test_ncbi_core.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2009-03-19 10:17:26 UTC
  • mfrom: (1.3.1 upstream) (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090319101726-wjuj7ajnq0w5a0mg
Tags: 6.1.20090301-1
* New upstream release; uploading to unstable now that lenny is out.
* debian/lib{ncbi6,vibrant6a}.symbols: update accordingly.
* doc/man/*.1: update accordingly as well.
* debian/control: place lib*-dbg in the new debug section, per the
  current override file.
* debian/control: declare compliance with Policy 3.8.1 (no changes needed).
* api/aliread.c: merge in fix (from 6.1.20080302-4) to undefined use of
  sprintf caught by Kees Cook's scan.
* debian/watch: belatedly update regex to recognize releases like the
  previous one ([6.1.]20081116a).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  $Id: test_ncbi_core.c,v 6.15 2008/02/28 20:25:52 kazimird Exp $
 
1
/*  $Id: test_ncbi_core.c,v 6.18 2008/11/28 23:59:43 kazimird Exp $
2
2
 * ===========================================================================
3
3
 *
4
4
 *                            PUBLIC DOMAIN NOTICE
66
66
 *  TEST_CORE -- test "ncbi_core.c"
67
67
 */
68
68
 
69
 
static void TEST_CORE_Generic(void)
70
 
{
71
 
  /* STimeout */
72
 
  static STimeout x_timeout = { 111111, 222222 };
73
 
  x_timeout.sec  = (unsigned int) 333333;
74
 
  x_timeout.usec = (unsigned int) 444444;
75
 
}
76
 
 
77
69
 
78
70
static void TEST_CORE_Io(void)
79
71
{
259
251
  assert(TEST_CORE_LogUserData == 1);
260
252
 
261
253
  LOG_WRITE(0, 0, 0, eLOG_Trace, 0);
262
 
  LOG_Write(0, 0, 0, eLOG_Trace, 0, 0, 0, 0);
 
254
  LOG_Write(0, 0, 0, eLOG_Trace, 0, 0, 0, 0, 0, 0);
263
255
  LOG_WRITE(x_log, 0, 0, eLOG_Trace, 0);
264
 
  LOG_Write(x_log, 0, 0, eLOG_Trace, 0, 0, 0, 0);
 
256
  LOG_Write(x_log, 0, 0, eLOG_Trace, 0, 0, 0, 0, 0, 0);
265
257
 
266
258
  verify(LOG_Delete(x_log) == x_log);
267
259
  assert(TEST_CORE_LogUserData == 1);
274
266
 
275
267
  /* do the test logging */
276
268
  LOG_WRITE(x_log, 0, 0, eLOG_Trace, 0);
277
 
  LOG_Write(x_log, 0, 0, eLOG_Trace, 0, 0, 0, 0);
 
269
  LOG_Write(x_log, 0, 0, eLOG_Trace, 0, 0, 0, 0, 0, 0);
278
270
  LOG_WRITE(x_log, 0, 0, eLOG_Warning, "");
279
271
  /* LOG_WRITE(x_log, eLOG_Fatal, "Something fatal"); */
280
272
#undef  THIS_MODULE
297
289
static void TEST_CORE(void)
298
290
{
299
291
  /* Do all TEST_CORE_***() tests */
300
 
  DO_TEST(TEST_CORE_Generic);
301
292
  DO_TEST(TEST_CORE_Io);
302
293
  DO_TEST(TEST_CORE_Lock);
303
294
  DO_TEST(TEST_CORE_Log);
317
308
 
318
309
  /* simple logging */
319
310
  LOG_WRITE(x_log, 0, 0, eLOG_Trace, 0);
320
 
  LOG_Write(x_log, 0, 0, eLOG_Trace, 0, 0, 0, 0);
 
311
  LOG_Write(x_log, 0, 0, eLOG_Trace, 0, 0, 0, 0, 0, 0);
321
312
  LOG_WRITE(x_log, 0, 0, eLOG_Warning, "");
322
313
  /* LOG_WRITE(x_log, eLOG_Fatal, "Something fatal"); */
323
314
#undef  THIS_MODULE
341
332
    LOG_DATA(x_log, 0, 0, eLOG_Note, data, sizeof(data), "Data logging test");
342
333
  }}
343
334
 
344
 
  /* logging with errno */
345
 
  errno = 0;
346
 
  LOG_WRITE_ERRNO(x_log, 0, 0, eLOG_Warning, 0);  
347
 
  LOG_WRITE_ERRNO(x_log, 0, 0, eLOG_Error, "");
348
 
  LOG_WRITE_ERRNO(x_log, 0, 0, eLOG_Critical, "OKAY");
349
 
 
350
 
#undef  THIS_FILE
351
 
#define THIS_FILE 0
352
 
  (void)strtod("1e-999999", 0);  LOG_WRITE_ERRNO(x_log, 0, 0, eLOG_Warning, 0);  
353
 
  (void)strtod("1e-999999", 0);  LOG_WRITE_ERRNO(x_log, 0, 0, eLOG_Error, "");
354
 
  (void)strtod("1e-999999", 0);  LOG_WRITE_ERRNO(x_log, 0, 0, eLOG_Critical, "FAIL");
355
 
 
356
335
  /* delete */
357
336
  verify(LOG_Delete(x_log) == 0);
358
337
}