From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B2C5F402E2 for ; Mon, 21 Feb 2022 06:03:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 91CBB68B132; Mon, 21 Feb 2022 08:03:05 +0200 (EET) Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1454968B124 for ; Mon, 21 Feb 2022 08:02:59 +0200 (EET) Received: by mail-pj1-f42.google.com with SMTP id cp23-20020a17090afb9700b001bbfe0fbe94so4546736pjb.3 for ; Sun, 20 Feb 2022 22:02:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jE8X3uh7Crf7ivRonNUOoyPjSiUOCVQODh1AGwYsir8=; b=Ka31BJF8l/RSXn4elLcXtIS33L+HSJLIKNouI3qf/FIimOkrXYYxG2q3th7zoRjHVG fyaNv7QI4eTMVGnopXWxDdj4SyiWdoDMmgUGt4qrxY26ItG0zzT+w/BRNVJTxtXko/vg 3p2xdrrqzBlmAZa2x7nXK7+V4c1a/y7y/fU3/02Iwyotf/1wOjx7DWHpbpcu86W1L9Zp bPTjZmFP2/TtnpSQ0pB7AE+yGbm0AvHn8HQ71z38I5mcKcStcv48YqQS+P1TgNOAlQkf sitP8/TiKl0V6pgsGKTjiUAubNNula+zaV24KyYlzgs//Ytpl4naM3oJ/U1O5fO7m00z 2xfQ== X-Gm-Message-State: AOAM533ypFM2oZGJIZiGIVGsFC363DFRGEgXtJw/B/kj8XmwnXZcoog+ BuIkGZSi1kiswwC7bLk5sc5RM/sq0ko= X-Google-Smtp-Source: ABdhPJwzL8KvsAbHufyrh5sTSfs/jV8ui8ULVETLsGAv1dNaj2/dYuJ0cCrqwnlgooQdCaK2enCRTA== X-Received: by 2002:a17:90a:5b06:b0:1b8:b705:470b with SMTP id o6-20020a17090a5b0600b001b8b705470bmr19615061pji.168.1645423377226; Sun, 20 Feb 2022 22:02:57 -0800 (PST) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id e20sm9610220pfv.42.2022.02.20.22.02.55 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Feb 2022 22:02:56 -0800 (PST) Received: by localhost (sSMTP sendmail emulation); Sun, 20 Feb 2022 22:02:44 -0800 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Sun, 20 Feb 2022 22:02:28 -0800 Message-Id: <20220221060230.6665-5-pal@sandflow.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20220221060230.6665-1-pal@sandflow.com> References: <20220221060230.6665-1-pal@sandflow.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 5/7] avutil/tests: add test for avutil/mathematics X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Pierre-Anthony Lemieux Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Pierre-Anthony Lemieux --- libavutil/Makefile | 1 + libavutil/tests/.gitignore | 1 + libavutil/tests/mathematics.c | 57 +++++++++++++++++++++++++++++++++++ tests/fate/libavutil.mak | 5 +++ 4 files changed, 64 insertions(+) create mode 100644 libavutil/tests/mathematics.c diff --git a/libavutil/Makefile b/libavutil/Makefile index d17876df1a..d1c002e43f 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -239,6 +239,7 @@ TESTPROGS = adler32 \ lfg \ lls \ log \ + mathematics \ md5 \ murmur3 \ opt \ diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore index 9d90827954..aba94af388 100644 --- a/libavutil/tests/.gitignore +++ b/libavutil/tests/.gitignore @@ -30,6 +30,7 @@ /lls /log /lzo +/mathematics /md5 /murmur3 /opt diff --git a/libavutil/tests/mathematics.c b/libavutil/tests/mathematics.c new file mode 100644 index 0000000000..45a82617aa --- /dev/null +++ b/libavutil/tests/mathematics.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2022 Pierre-Anthony Lemieux + * + * 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 "libavutil/mathematics.h" + +int main(void) +{ + int64_t ts_min; + int64_t ts; + int64_t ts_max; + + ts_min = 10; + ts = 20; + ts_max = 30; + + av_rescale_interval(av_make_q(1, 1), av_make_q(10, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 1 || ts != 2 || ts_max != 3) + return 1; + + ts_min = 10; + ts = 32; + ts_max = 32; + + av_rescale_interval(av_make_q(1, 1), av_make_q(3, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 4 || ts != 11 || ts_max != 10) + return 1; + + ts_min = 10; + ts = 10; + ts_max = 32; + + av_rescale_interval(av_make_q(1, 1), av_make_q(3, 1), &ts_min, &ts, &ts_max); + + if (ts_min != 4 || ts != 3 || ts_max != 10) + return 1; + + return 0; +} diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak index 1ec9ed00ad..92b9b82aa8 100644 --- a/tests/fate/libavutil.mak +++ b/tests/fate/libavutil.mak @@ -166,6 +166,11 @@ FATE_LIBAVUTIL += fate-opt fate-opt: libavutil/tests/opt$(EXESUF) fate-opt: CMD = run libavutil/tests/opt$(EXESUF) +FATE_LIBAVUTIL += fate-mathematics +fate-mathematics: libavutil/tests/mathematics$(EXESUF) +fate-mathematics: CMD = run libavutil/tests/mathematics$(EXESUF) +fate-mathematics: CMP = null + FATE_LIBAVUTIL += $(FATE_LIBAVUTIL-yes) FATE-$(CONFIG_AVUTIL) += $(FATE_LIBAVUTIL) fate-libavutil: $(FATE_LIBAVUTIL) -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".