IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10702


Ignore:
Timestamp:
Dec 13, 2006, 3:37:17 PM (19 years ago)
Author:
jhoblitt
Message:

add diag output to ok_strn()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/pstap/src/pstap.h

    r9935 r10702  
    4040}
    4141
    42 # define ok_strn(VALUE,EXPECT,N,COMMENT, ...)\
    43 ok(strncmp(VALUE, EXPECT, N) == 0, COMMENT, ## __VA_ARGS__);
     42# define ok_strn(VALUE, EXPECT, N, COMMENT, ...)\
     43{ \
     44    int cmp = (strncmp(VALUE, EXPECT, N) == 0); \
     45    ok(cmp, COMMENT, ## __VA_ARGS__); \
     46    if (!cmp) { \
     47        diag("         got: '%s'", VALUE); \
     48        diag("    expected: '%s'", EXPECT); \
     49    } \
     50}
    4451
    4552#elif __STDC_VERSION__ >= 199901L /* __GNUC__ */
     
    6168ok((fabsl((VALUE)-(EXPECT)) < )(TOL)), __VA_ARGS__);
    6269
    63 # define ok_str(VALUE, EXPECT, COMMENT, ...) \
     70# define ok_str(VALUE, EXPECT, ...) \
    6471{ \
    6572    int cmp = (strcmp(VALUE, EXPECT) == 0); \
     
    7178}
    7279
    73 # define ok_strn(VALUE,EXPECT,N, ...)\
    74 ok(strncmp(VALUE, EXPECT, N) == 0, __VA_ARGS__);
     80# define ok_strn(VALUE, EXPECT, N, ...)\
     81{ \
     82    int cmp = (strncmp(VALUE, EXPECT, N) == 0); \
     83    ok(cmp, COMMENT,  __VA_ARGS__); \
     84    if (!cmp) { \
     85        diag("         got: '%s'", VALUE); \
     86        diag("    expected: '%s'", EXPECT); \
     87    } \
     88}
    7589
    7690#else /* __STDC_VERSION__ */
Note: See TracChangeset for help on using the changeset viewer.