[FFmpeg-devel] [PATCH] avutil: Added selftest for libavutil/audio_fifo.c

Michael Niedermayer michael at niedermayer.cc
Sat Dec 17 19:42:56 EET 2016


On Sat, Dec 17, 2016 at 03:16:30AM -0800, Thomas Turner wrote:
> Signed-off-by: Thomas Turner <thomastdt at googlemail.com>
> ---
>  libavutil/Makefile           |   1 +
>  libavutil/tests/audio_fifo.c | 196 +++++++++++++++++++++++++++++++++++++
>  tests/fate/libavutil.mak     |   4 +
>  tests/ref/fate/audio_fifo    | 228 +++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 429 insertions(+)
>  create mode 100644 libavutil/tests/audio_fifo.c
>  create mode 100644 tests/ref/fate/audio_fifo
> 
> diff --git a/libavutil/Makefile b/libavutil/Makefile
> index 9841645..2dd91b8 100644
> --- a/libavutil/Makefile
> +++ b/libavutil/Makefile
> @@ -182,6 +182,7 @@ SKIPHEADERS-$(CONFIG_OPENCL)           += opencl.h
>  TESTPROGS = adler32                                                     \
>              aes                                                         \
>              atomic                                                      \
> +            audio_fifo                                                  \
>              avstring                                                    \
>              base64                                                      \
>              blowfish                                                    \
> diff --git a/libavutil/tests/audio_fifo.c b/libavutil/tests/audio_fifo.c
> new file mode 100644
> index 0000000..6dffe85
> --- /dev/null
> +++ b/libavutil/tests/audio_fifo.c
> @@ -0,0 +1,196 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include <stdlib.h>
> +#include <inttypes.h>
> +#include "libavutil/audio_fifo.c"
> +#include "libavutil/audio_fifo.h"
> +#include "libavutil/error.h"
> +
> +#define MAX_CHANNELS    32
> +
> +#define ERROR(str)                    \
> +        fprintf(stderr, "%s\n", str); \
> +        exit(1);

this should be wraped in do{...}while(0)
so that code like

if (...)
    ERROR(str);

works as expectec

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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161217/c55fdb61/attachment.sig>


More information about the ffmpeg-devel mailing list