[FFmpeg-devel] [PATCH] remove unused and broken test program in libavutil/base64.c

Michael Niedermayer michaelni
Wed Jan 28 18:15:14 CET 2009


On Wed, Jan 28, 2009 at 12:02:34AM +0100, Stefano Sabatini wrote:
> On date Tuesday 2009-01-27 03:01:01 +0100, Michael Niedermayer encoded:
> > On Mon, Jan 26, 2009 at 11:28:18PM +0100, Stefano Sabatini wrote:
> [...]
> > > > > It turned out in a semi-complete rewrite of the test program, anyway I
> > > > > don't feel like to send a patch and discuss every single change, if
> > > > > it's possible to simply replace the new code I'll happily do it.
> > 
> > you know likely (after actually thinking about it at least)
> > that diffing old code against rewritten codeis not that usefull
> > for the purpose of reading/reviewing
> 
> Here it is:
> 
> -----8<-----8<------------------------------------------------------
> #ifdef TEST
> #include "log.h"
> #include "mem.h"
> 
> #undef printf

> #undef srand
> #undef rand

is there a problem with our random number generators?


> 
> int main(void)
> {
>     int numerr = 0;
> 
>     struct test {

>         void *data;

looks like const char


>         int data_size;
>         const char *encoded;
>     } *t, tests[] = {
>         { "", 0, ""},
>         { "1", 1, "MQ=="},
>         { "22", 2, "MjI="},
>         { "333", 3, "MzMz"},
>         { "4444", 4, "NDQ0NA=="},
>         { "55555", 5, "NTU1NTU="},
>         { "abc:def", 7, "YWJjOmRlZg=="},
>         { NULL}
>     };
> 
>     printf("Encoding/decoding tests on constant data\n");
>     for (t = tests; t->data; t++) {
>         char encoded[1024];
>         uint8_t data[1024];
>         int data_size;
> 
>         printf("Encoding '%s'... ", (char *)t->data);
>         if (av_base64_encode(encoded, sizeof(encoded), t->data, t->data_size)) {
>             printf("encoded to '%s'\n", encoded);

>             if (strcmp(encoded, t->encoded) != 0) {

superflous != 0


[...]
>     printf("\n");
> 
>     printf("Encoding/decoding tests on random data\n");

can be merged


>     {
>         int test_count;
>         srand(123141);          // time(NULL));
>         for (test_count = 0; test_count < 100; test_count++) {
>             int data_size = rand() % 1024;
>             char *encoded[2048];

>             uint8_t *data = (uint8_t *)av_malloc(data_size);

useless cast

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090128/74379f2b/attachment.pgp>



More information about the ffmpeg-devel mailing list