You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Jeff Trawick <tr...@bellsouth.net> on 2001/05/13 17:40:45 UTC

Re: cvs commit: apr/test testmd5.c

dreid@apache.org writes:

> dreid       01/05/13 03:53:01
> 
>   Modified:    test     testmd5.c
>   Log:
>   Another small update of a test program that I did yesterday afternoon.
>   
>   Revision  Changes    Path
>   1.8       +34 -13    apr/test/testmd5.c
>   
>   Index: testmd5.c
>   ===================================================================
>   RCS file: /home/cvs/apr/test/testmd5.c,v
>   retrieving revision 1.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- testmd5.c	2001/03/31 07:29:06	1.7
>   +++ testmd5.c	2001/05/13 10:53:01	1.8
>   @@ -95,31 +95,43 @@
>        apr_status_t rv;
>        apr_md5_ctx_t context;
>        unsigned char hash[MD5_DIGESTSIZE];
>   +    
>   +    printf("Trying a translation...\n");
>    
>   -    rv = apr_md5_init(&context);
>   -    assert(!rv);
>   +    if ((rv = apr_md5_init(&context)) != APR_SUCCESS){
>   +        printf("Failed to init APR's md5 routines!\n");
>   +        exit(-1);
>   +    }

It's unclear what the improvement is here :)  Before at least we got a
coredump and can find out the bad return code in a few seconds.  Now
the code is more cluttered and it takes longer to find why it failed.
Of course we can add logic to format the APR return code, but why all
the effort for something which is unlikely to fail?

Also (not unique to your changes), it would be helpful if error
messages in the test programs go to stderr, not stdout.  A regression
test can then do things like track changes to error messages without
worrying about changes to non-error messages, which change on a
regular basis when people play with the code, or may have
user-environment-specific displays like current time.

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...