From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 2/3] avutil/tests/opt: test values > INT_MAX for INT64 type
Date: Tue, 27 Feb 2024 17:30:39 -0300
Message-ID: <20240227203040.1989-2-jamrial@gmail.com> (raw)
In-Reply-To: <20240227203040.1989-1-jamrial@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavutil/tests/opt.c | 5 +++--
tests/ref/fate/opt | 25 ++++++++++++++-----------
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c
index a914d0359a..11f29468fb 100644
--- a/libavutil/tests/opt.c
+++ b/libavutil/tests/opt.c
@@ -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 }, -1, 100, 1 },
+ {"num64", "set num 64bit", OFFSET(num64), AV_OPT_TYPE_INT64, { .i64 = 1LL << 32 }, -1, 1LL << 32, 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 },
@@ -296,7 +296,8 @@ int main(void)
"num64=44.4",
"num64=-1",
"num64=-2",
- "num64=101",
+ "num64=4294967296",
+ "num64=4294967297",
"flt=bogus",
"flt=2",
"flt=2.2",
diff --git a/tests/ref/fate/opt b/tests/ref/fate/opt
index 2da155aa2b..d164b9eb0c 100644
--- a/tests/ref/fate/opt
+++ b/tests/ref/fate/opt
@@ -14,7 +14,7 @@ color=255 192 203 255
channel_layout=311=311
binary=62 69 6e 0
binary_size=4
-num64=1
+num64=4294967296
flt=0.333333
dbl=0.333333
TestContext AVOptions:
@@ -37,7 +37,7 @@ TestContext AVOptions:
-bin <binary> E.......... set binary value
-bin1 <binary> E.......... set binary value
-bin2 <binary> E.......... set binary value
- -num64 <int64> E.......... set num 64bit (from -1 to 100) (default 1)
+ -num64 <int64> E.......... set num 64bit (from -1 to 4.29497e+09) (default 4294967296)
-flt <float> E.......... set float (from 0 to 100) (default 0.333333)
-dbl <double> E.......... set double (from 0 to 100) (default 0.333333)
-bool1 <boolean> E.......... set boolean value (default auto)
@@ -119,7 +119,7 @@ name: cl get: hexagonal set: OK get: hexagonal
name: bin get: 62696E00 set: OK get: 62696E00 OK
name: bin1 get: set: OK get: OK
name: bin2 get: set: OK get: OK
-name: num64 get: 1 set: OK get: 1 OK
+name: num64 get: 4294967296 set: OK get: 4294967296 OK
name: flt get: 0.333333 set: OK get: 0.333333 OK
name: dbl get: 0.333333 set: OK get: 0.333333 OK
name: bool1 get: auto set: OK get: auto OK
@@ -129,7 +129,7 @@ name: dict1 get: set: OK get:
name: dict2 get: happy=\:-) set: OK get: happy=\:-) OK
Test av_opt_serialize()
-num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=1,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-)
+num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=4294967296,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-)
Setting entry with key 'num' to value '0'
Setting entry with key 'toggle' to value '1'
Setting entry with key 'rational' to value '1/1'
@@ -146,7 +146,7 @@ Setting entry with key 'cl' to value 'hexagonal'
Setting entry with key 'bin' to value '62696E00'
Setting entry with key 'bin1' to value ''
Setting entry with key 'bin2' to value ''
-Setting entry with key 'num64' to value '1'
+Setting entry with key 'num64' to value '4294967296'
Setting entry with key 'flt' to value '0.333333'
Setting entry with key 'dbl' to value '0.333333'
Setting entry with key 'bool1' to value 'auto'
@@ -154,7 +154,7 @@ Setting entry with key 'bool2' to value 'true'
Setting entry with key 'bool3' to value 'false'
Setting entry with key 'dict1' to value ''
Setting entry with key 'dict2' to value 'happy=\:-)'
-num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=1,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-)
+num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=hexagonal,bin=62696E00,bin1=,bin2=,num64=4294967296,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-)
Testing av_set_options_string()
Setting options string ''
@@ -350,12 +350,15 @@ Setting entry with key 'num64' to value '-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]
+Value -2.000000 for parameter 'num64' out of range [-1 - 4.29497e+09]
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 [-1 - 100]
-Error 'num64=101'
+Setting options string 'num64=4294967296'
+Setting entry with key 'num64' to value '4294967296'
+OK 'num64=4294967296'
+Setting options string 'num64=4294967297'
+Setting entry with key 'num64' to value '4294967297'
+Value 4294967297.000000 for parameter 'num64' out of range [-1 - 4.29497e+09]
+Error 'num64=4294967297'
Setting options string 'flt=bogus'
Setting entry with key 'flt' to value 'bogus'
Undefined constant or missing '(' in 'bogus'
--
2.43.2
_______________________________________________
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".
next prev parent reply other threads:[~2024-02-27 20:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 20:30 [FFmpeg-devel] [PATCH 1/3 v2] avutil/tests/opt: test negative values for INT and INT64 types James Almer
2024-02-27 20:30 ` James Almer [this message]
2024-02-27 20:30 ` [FFmpeg-devel] [PATCH 3/3 v2] avutil/opt: add an unsigned option type James Almer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240227203040.1989-2-jamrial@gmail.com \
--to=jamrial@gmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git