History

avutil/tests/opt: test values > INT_MAX for INT64 type

James Almer committed 2 years ago

Commit 9902fc51 parent 72ac4952 files · +17 −13Browse files

Unified · Split

2 files
  1. libavutil/tests/opt.c +3 −2
  2. tests/ref/fate/opt +14 −11
libavutil/tests/opt.c+3−2
@@ -105,7 +105,7 @@ static const AVOption test_options[]= { · 104 unmodified lines
105105 {"bin", "set binary value", OFFSET(binary), AV_OPT_TYPE_BINARY, { .str="62696e00" }, 0, 0, 1 },
106106 {"bin1", "set binary value", OFFSET(binary1), AV_OPT_TYPE_BINARY, { .str=NULL }, 0, 0, 1 },
107107 {"bin2", "set binary value", OFFSET(binary2), AV_OPT_TYPE_BINARY, { .str="" }, 0, 0, 1 },
108− {"num64", "set num 64bit", OFFSET(num64), AV_OPT_TYPE_INT64, { .i64 = 1 }, -1, 100, 1 },
108+ {"num64", "set num 64bit", OFFSET(num64), AV_OPT_TYPE_INT64, { .i64 = 1LL << 32 }, -1, 1LL << 32, 1 },
109109 {"flt", "set float", OFFSET(flt), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 / 3 }, 0, 100, 1 },
110110 {"dbl", "set double", OFFSET(dbl), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 / 3 }, 0, 100, 1 },
111111 {"bool1", "set boolean value", OFFSET(bool1), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, 1 },
@@ -391,7 +391,8 @@ int main(void) · 279 unmodified lines
391391 "num64=44.4",
392392 "num64=-1",
393393 "num64=-2",
394− "num64=101",
394+ "num64=4294967296",
395+ "num64=4294967297",
395396 "flt=bogus",
396397 "flt=2",
397398 "flt=2.2",
tests/ref/fate/opt+14−11
@@ -14,7 +14,7 @@ color=255 192 203 255 · 13 unmodified lines
1414 channel_layout=311=311
1515 binary=62 69 6e 0
1616 binary_size=4
17−num64=1
17+num64=4294967296
1818 flt=0.333333
1919 dbl=0.333333
2020 array_str[0]=str0
@@ -43,7 +43,7 @@ TestContext AVOptions: · 22 unmodified lines
4343 -bin <binary> E.......... set binary value
4444 -bin1 <binary> E.......... set binary value
4545 -bin2 <binary> E.......... set binary value
46− -num64 <int64> E.......... set num 64bit (from -1 to 100) (default 1)
46+ -num64 <int64> E.......... set num 64bit (from -1 to 4.29497e+09) (default 4294967296)
4747 -flt <float> E.......... set float (from 0 to 100) (default 0.333333)
4848 -dbl <double> E.......... set double (from 0 to 100) (default 0.333333)
4949 -bool1 <boolean> E.......... set boolean value (default auto)
@@ -134,7 +134,7 @@ name: cl get: hexagonal set: OK get: hexagonal · 84 unmodified lines
134134 name: bin get: 62696E00 set: OK get: 62696E00 OK
135135 name: bin1 get: set: OK get: OK
136136 name: bin2 get: set: OK get: OK
137−name: num64 get: 1 set: OK get: 1 OK
137+name: num64 get: 4294967296 set: OK get: 4294967296 OK
138138 name: flt get: 0.333333 set: OK get: 0.333333 OK
139139 name: dbl get: 0.333333 set: OK get: 0.333333 OK
140140 name: bool1 get: auto set: OK get: auto OK
@@ -150,7 +150,7 @@ array_dict=NULL; nb_array_dict=0 · 9 unmodified lines
150150 av_opt_get("array_dict") -> NULL
151151
152152 Test av_opt_serialize()
153−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\=\\:-),array_int=,array_str=str0|str\\|1|str\\\\2,array_dict=k00\=v\\\\\\\\00:k01\=v\\\,01\,k10\=v\\\\\=1\\\\:0
153+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\=\\:-),array_int=,array_str=str0|str\\|1|str\\\\2,array_dict=k00\=v\\\\\\\\00:k01\=v\\\,01\,k10\=v\\\\\=1\\\\:0
154154 Setting entry with key 'num' to value '0'
155155 Setting entry with key 'toggle' to value '1'
156156 Setting entry with key 'rational' to value '1/1'
@@ -167,7 +167,7 @@ Setting entry with key 'cl' to value 'hexagonal' · 10 unmodified lines
167167 Setting entry with key 'bin' to value '62696E00'
168168 Setting entry with key 'bin1' to value ''
169169 Setting entry with key 'bin2' to value ''
170−Setting entry with key 'num64' to value '1'
170+Setting entry with key 'num64' to value '4294967296'
171171 Setting entry with key 'flt' to value '0.333333'
172172 Setting entry with key 'dbl' to value '0.333333'
173173 Setting entry with key 'bool1' to value 'auto'
@@ -178,7 +178,7 @@ Setting entry with key 'dict2' to value 'happy=\:-)' · 4 unmodified lines
178178 Setting entry with key 'array_int' to value ''
179179 Setting entry with key 'array_str' to value 'str0|str\|1|str\\2'
180180 Setting entry with key 'array_dict' to value 'k00=v\\\\00:k01=v\,01,k10=v\\=1\\:0'
181−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\=\\:-),array_int=,array_str=str0|str\\|1|str\\\\2,array_dict=k00\=v\\\\\\\\00:k01\=v\\\,01\,k10\=v\\\\\=1\\\\:0
181+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\=\\:-),array_int=,array_str=str0|str\\|1|str\\\\2,array_dict=k00\=v\\\\\\\\00:k01\=v\\\,01\,k10\=v\\\\\=1\\\\:0
182182 child_num=0,flt=0.333333,dbl=0.333333,array_int=
183183
184184 Testing av_set_options_string()
@@ -375,12 +375,15 @@ Setting entry with key 'num64' to value '-1' · 190 unmodified lines
375375 OK 'num64=-1'
376376 Setting options string 'num64=-2'
377377 Setting entry with key 'num64' to value '-2'
378−Value -2.000000 for parameter 'num64' out of range [-1 - 100]
378+Value -2.000000 for parameter 'num64' out of range [-1 - 4.29497e+09]
379379 Error 'num64=-2'
380−Setting options string 'num64=101'
381−Setting entry with key 'num64' to value '101'
382−Value 101.000000 for parameter 'num64' out of range [-1 - 100]
383−Error 'num64=101'
380+Setting options string 'num64=4294967296'
381+Setting entry with key 'num64' to value '4294967296'
382+OK 'num64=4294967296'
383+Setting options string 'num64=4294967297'
384+Setting entry with key 'num64' to value '4294967297'
385+Value 4294967297.000000 for parameter 'num64' out of range [-1 - 4.29497e+09]
386+Error 'num64=4294967297'
384387 Setting options string 'flt=bogus'
385388 Setting entry with key 'flt' to value 'bogus'
386389 Undefined constant or missing '(' in 'bogus'

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t