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 B1BCC49B2E for ; Sun, 3 Mar 2024 16:25:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9085A68D377; Sun, 3 Mar 2024 18:25:10 +0200 (EET) Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A661468C4B8 for ; Sun, 3 Mar 2024 18:25:03 +0200 (EET) Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a450615d1c4so102034266b.0 for ; Sun, 03 Mar 2024 08:25:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709483102; x=1710087902; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=sdq5qQUez/MQtcB6gyKsTcC/BYGN+2KdCuxJFRmUTdE=; b=Hq4JaVTF/HTzxaMeazta36uobPVLbWEVJM401IrBD5+/fO9vi5hpKsy4B/YJyfSSh9 tOb7+wpI4se7g9a/LRLG+8mY5qQaZo48jUoKGrHFlIgk+fHs53//CXnGDPTSbndzW8U+ ZO6Z5mSyUD1NSYOjLyVXlHDRk97cNfoQxJVv+4TaOLGitEYgR+HR+wdQU0cQKTRBJqL/ oBW2jWJFBXnNmzmklE+SJEW8kyuXMfD54qsbnDaa8kNjx8wr3SD3XyCbGMPnUa+ZoAiI /00tR9uSpQ0rB/otWnj2Njiyf57NYpjQtlj/vSY5W3Hx2nhBnqa3QaTu7XES0c3A8rZX k1Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709483102; x=1710087902; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=sdq5qQUez/MQtcB6gyKsTcC/BYGN+2KdCuxJFRmUTdE=; b=PRBF8bHtH1V5AOtQA38bzOlQebSLaFmli5wevz7yvhmV64ktVm6BP7AnOZ1lBeTi5g hDtFqHiV6G3BGfNBNwJwpMwOoD3WPLfIiT2DVk0PYwOaHV9BklgFHtPZvFOSq3FPLBYI 8IJuo5ygl8VcM6QywLhcNpI5cszFnm2H6r2aYhCpiSfBzR0cg4nltTwx2PUVuGel1cEc Yf3Z+fU72wl1T6H670x92Lytfxq8RwriZZPYiuLiGEWzDaZ/6RxYtuT412x3QKy2ckN0 z/sU53uqkz2T1m1wtmmxfnkFfyMeNkFOrw7gQZT64fjP2f+7ukjwXYaVGN0cAiXaaj0g Qpdw== X-Gm-Message-State: AOJu0Yz0v4F03qdjEgjjJh4B/DbwAMsM2GSCKKeASpG1WOhytN5PdcUf dSDqE7IBZwOANjlC0aktJrA+K7eLMsUxICtYvdpbJTcqFkXTjR6VxoIkbhoT X-Google-Smtp-Source: AGHT+IGpssCuEqVZfH6WH+WlxCGuz+US3M1QwF4eGDKWI+q4IpwJFYAOASEq0Q+bfF8tqHY4PaIMbw== X-Received: by 2002:a17:906:a404:b0:a3f:cd6b:80fd with SMTP id l4-20020a170906a40400b00a3fcd6b80fdmr5919852ejz.7.1709483101855; Sun, 03 Mar 2024 08:25:01 -0800 (PST) Received: from mariano ([188.210.239.74]) by smtp.gmail.com with ESMTPSA id y1-20020a1709060bc100b00a43aa27b5f2sm3827812ejg.94.2024.03.03.08.25.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 08:25:01 -0800 (PST) Received: by mariano (Postfix, from userid 1000) id 0407ABFCDC; Sun, 3 Mar 2024 17:24:59 +0100 (CET) Date: Sun, 3 Mar 2024 17:24:59 +0100 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches References: <20240227135947.503-1-jamrial@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240227135947.503-1-jamrial@gmail.com> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH 1/2] avutil/tests/opt: test negative values for INT and INT64 types 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 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: On date Tuesday 2024-02-27 10:59:46 -0300, James Almer wrote: > Signed-off-by: James Almer > --- > libavutil/tests/opt.c | 11 +++++++++-- > tests/ref/fate/opt | 35 ++++++++++++++++++++++++++++++----- > 2 files changed, 39 insertions(+), 7 deletions(-) > > diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c > index e2582cc93d..a914d0359a 100644 > --- a/libavutil/tests/opt.c > +++ b/libavutil/tests/opt.c > @@ -66,7 +66,7 @@ typedef struct TestContext { > #define TEST_FLAG_MU 04 > > static const AVOption test_options[]= { > - {"num", "set num", OFFSET(num), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, 1 }, > + {"num", "set num", OFFSET(num), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 100, 1 }, > {"toggle", "set toggle", OFFSET(toggle), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, 1 }, > {"rational", "set rational", OFFSET(rational), AV_OPT_TYPE_RATIONAL, { .dbl = 1 }, 0, 10, 1 }, > {"string", "set string", OFFSET(string), AV_OPT_TYPE_STRING, { .str = "default" }, CHAR_MIN, CHAR_MAX, 1 }, > @@ -85,7 +85,7 @@ static const AVOption test_options[]= { > {"bin", "set binary value", OFFSET(binary), AV_OPT_TYPE_BINARY, { .str="62696e00" }, 0, 0, 1 }, > {"bin1", "set binary value", OFFSET(binary1), AV_OPT_TYPE_BINARY, { .str=NULL }, 0, 0, 1 }, > {"bin2", "set binary value", OFFSET(binary2), AV_OPT_TYPE_BINARY, { .str="" }, 0, 0, 1 }, > - {"num64", "set num 64bit", OFFSET(num64), AV_OPT_TYPE_INT64, { .i64 = 1 }, 0, 100, 1 }, > + {"num64", "set num 64bit", OFFSET(num64), AV_OPT_TYPE_INT64, { .i64 = 1 }, -1, 100, 1 }, > {"flt", "set float", OFFSET(flt), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 / 3 }, 0, 100, 1 }, > {"dbl", "set double", OFFSET(dbl), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 / 3 }, 0, 100, 1 }, > {"bool1", "set boolean value", OFFSET(bool1), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, 1 }, > @@ -285,10 +285,17 @@ int main(void) > "bin=boguss", > "bin=111", > "bin=ffff", > + "num=bogus", > + "num=44", > + "num=44.4", > + "num=-1", > + "num=-2", > + "num=101", > "num64=bogus", > "num64=44", > "num64=44.4", > "num64=-1", > + "num64=-2", > "num64=101", > "flt=bogus", > "flt=2", > diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt > index 832f9cc8a9..2da155aa2b 100644 > --- a/tests/ref/fate/opt > +++ b/tests/ref/fate/opt > @@ -18,7 +18,7 @@ num64=1 > flt=0.333333 > dbl=0.333333 > TestContext AVOptions: > - -num E.......... set num (from 0 to 100) (default 0) > + -num E.......... set num (from -1 to 100) (default 0) > -toggle E.......... set toggle (from 0 to 1) (default 1) > -rational E.......... set rational (from 0 to 10) (default 1/1) > -string E.......... set string (default "default") > @@ -37,7 +37,7 @@ TestContext AVOptions: > -bin E.......... set binary value > -bin1 E.......... set binary value > -bin2 E.......... set binary value > - -num64 E.......... set num 64bit (from 0 to 100) (default 1) > + -num64 E.......... set num 64bit (from -1 to 100) (default 1) > -flt E.......... set float (from 0 to 100) (default 0.333333) > -dbl E.......... set double (from 0 to 100) (default 0.333333) > -bool1 E.......... set boolean value (default auto) > @@ -312,6 +312,28 @@ Error 'bin=111' > Setting options string 'bin=ffff' > Setting entry with key 'bin' to value 'ffff' > OK 'bin=ffff' > +Setting options string 'num=bogus' > +Setting entry with key 'num' to value 'bogus' > +Undefined constant or missing '(' in 'bogus' > +Unable to parse option value "bogus" > +Error 'num=bogus' > +Setting options string 'num=44' > +Setting entry with key 'num' to value '44' > +OK 'num=44' > +Setting options string 'num=44.4' > +Setting entry with key 'num' to value '44.4' > +OK 'num=44.4' > +Setting options string 'num=-1' > +Setting entry with key 'num' to value '-1' > +OK 'num=-1' > +Setting options string 'num=-2' > +Setting entry with key 'num' to value '-2' > +Value -2.000000 for parameter 'num' out of range [-1 - 100] > +Error 'num=-2' > +Setting options string 'num=101' > +Setting entry with key 'num' to value '101' > +Value 101.000000 for parameter 'num' out of range [-1 - 100] > +Error 'num=101' > Setting options string 'num64=bogus' > Setting entry with key 'num64' to value 'bogus' > Undefined constant or missing '(' in 'bogus' > @@ -325,11 +347,14 @@ Setting entry with key 'num64' to value '44.4' > OK 'num64=44.4' > Setting options string 'num64=-1' > Setting entry with key 'num64' to value '-1' > -Value -1.000000 for parameter 'num64' out of range [0 - 100] > -Error 'num64=-1' > +OK 'num64=-1' > +Setting options string 'num64=-2' > +Setting entry with key 'num64' to value '-2' > +Value -2.000000 for parameter 'num64' out of range [-1 - 100] > +Error 'num64=-2' > Setting options string 'num64=101' > Setting entry with key 'num64' to value '101' > -Value 101.000000 for parameter 'num64' out of range [0 - 100] > +Value 101.000000 for parameter 'num64' out of range [-1 - 100] > Error 'num64=101' > Setting options string 'flt=bogus' > Setting entry with key 'flt' to value 'bogus' LGTM. _______________________________________________ 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".