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
105 {"bin", "set binary value", OFFSET(binary), AV_OPT_TYPE_BINARY, { .str="62696e00" }, 0, 0, 1 },105 {"bin", "set binary value", OFFSET(binary), AV_OPT_TYPE_BINARY, { .str="62696e00" }, 0, 0, 1 },
106 {"bin1", "set binary value", OFFSET(binary1), AV_OPT_TYPE_BINARY, { .str=NULL }, 0, 0, 1 },106 {"bin1", "set binary value", OFFSET(binary1), AV_OPT_TYPE_BINARY, { .str=NULL }, 0, 0, 1 },
107 {"bin2", "set binary value", OFFSET(binary2), AV_OPT_TYPE_BINARY, { .str="" }, 0, 0, 1 },107 {"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 },
109 {"flt", "set float", OFFSET(flt), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 / 3 }, 0, 100, 1 },109 {"flt", "set float", OFFSET(flt), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 / 3 }, 0, 100, 1 },
110 {"dbl", "set double", OFFSET(dbl), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 / 3 }, 0, 100, 1 },110 {"dbl", "set double", OFFSET(dbl), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 / 3 }, 0, 100, 1 },
111 {"bool1", "set boolean value", OFFSET(bool1), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, 1 },111 {"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
391 "num64=44.4",391 "num64=44.4",
392 "num64=-1",392 "num64=-1",
393 "num64=-2",393 "num64=-2",
394 "num64=101",394 "num64=4294967296",
395 "num64=4294967297",
395 "flt=bogus",396 "flt=bogus",
396 "flt=2",397 "flt=2",
397 "flt=2.2",398 "flt=2.2",
tests/ref/fate/opt+14−11
@@ -14,7 +14,7 @@ color=255 192 203 255 · 13 unmodified lines
14channel_layout=311=31114channel_layout=311=311
15binary=62 69 6e 015binary=62 69 6e 0
16binary_size=416binary_size=4
17num64=117num64=4294967296
18flt=0.33333318flt=0.333333
19dbl=0.33333319dbl=0.333333
20array_str[0]=str020array_str[0]=str0
@@ -43,7 +43,7 @@ TestContext AVOptions: · 22 unmodified lines
43 -bin <binary> E.......... set binary value43 -bin <binary> E.......... set binary value
44 -bin1 <binary> E.......... set binary value44 -bin1 <binary> E.......... set binary value
45 -bin2 <binary> E.......... set binary value45 -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)
47 -flt <float> E.......... set float (from 0 to 100) (default 0.333333)47 -flt <float> E.......... set float (from 0 to 100) (default 0.333333)
48 -dbl <double> E.......... set double (from 0 to 100) (default 0.333333)48 -dbl <double> E.......... set double (from 0 to 100) (default 0.333333)
49 -bool1 <boolean> E.......... set boolean value (default auto)49 -bool1 <boolean> E.......... set boolean value (default auto)
@@ -134,7 +134,7 @@ name: cl get: hexagonal set: OK get: hexagonal · 84 unmodified lines
134name: bin get: 62696E00 set: OK get: 62696E00 OK134name: bin get: 62696E00 set: OK get: 62696E00 OK
135name: bin1 get: set: OK get: OK135name: bin1 get: set: OK get: OK
136name: bin2 get: set: OK get: OK136name: bin2 get: set: OK get: OK
137name: num64 get: 1 set: OK get: 1 OK137name: num64 get: 4294967296 set: OK get: 4294967296 OK
138name: flt get: 0.333333 set: OK get: 0.333333 OK138name: flt get: 0.333333 set: OK get: 0.333333 OK
139name: dbl get: 0.333333 set: OK get: 0.333333 OK139name: dbl get: 0.333333 set: OK get: 0.333333 OK
140name: bool1 get: auto set: OK get: auto OK140name: bool1 get: auto set: OK get: auto OK
@@ -150,7 +150,7 @@ array_dict=NULL; nb_array_dict=0 · 9 unmodified lines
150av_opt_get("array_dict") -> NULL150av_opt_get("array_dict") -> NULL
151 151
152Test av_opt_serialize()152Test av_opt_serialize()
153num=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\\\\:0153num=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
154Setting entry with key 'num' to value '0'154Setting entry with key 'num' to value '0'
155Setting entry with key 'toggle' to value '1'155Setting entry with key 'toggle' to value '1'
156Setting entry with key 'rational' to value '1/1'156Setting entry with key 'rational' to value '1/1'
@@ -167,7 +167,7 @@ Setting entry with key 'cl' to value 'hexagonal' · 10 unmodified lines
167Setting entry with key 'bin' to value '62696E00'167Setting entry with key 'bin' to value '62696E00'
168Setting entry with key 'bin1' to value ''168Setting entry with key 'bin1' to value ''
169Setting entry with key 'bin2' to value ''169Setting entry with key 'bin2' to value ''
170Setting entry with key 'num64' to value '1'170Setting entry with key 'num64' to value '4294967296'
171Setting entry with key 'flt' to value '0.333333'171Setting entry with key 'flt' to value '0.333333'
172Setting entry with key 'dbl' to value '0.333333'172Setting entry with key 'dbl' to value '0.333333'
173Setting entry with key 'bool1' to value 'auto'173Setting entry with key 'bool1' to value 'auto'
@@ -178,7 +178,7 @@ Setting entry with key 'dict2' to value 'happy=\:-)' · 4 unmodified lines
178Setting entry with key 'array_int' to value ''178Setting entry with key 'array_int' to value ''
179Setting entry with key 'array_str' to value 'str0|str\|1|str\\2'179Setting entry with key 'array_str' to value 'str0|str\|1|str\\2'
180Setting entry with key 'array_dict' to value 'k00=v\\\\00:k01=v\,01,k10=v\\=1\\:0'180Setting entry with key 'array_dict' to value 'k00=v\\\\00:k01=v\,01,k10=v\\=1\\:0'
181num=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\\\\:0181num=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
182child_num=0,flt=0.333333,dbl=0.333333,array_int=182child_num=0,flt=0.333333,dbl=0.333333,array_int=
183 183
184Testing av_set_options_string()184Testing av_set_options_string()
@@ -375,12 +375,15 @@ Setting entry with key 'num64' to value '-1' · 190 unmodified lines
375OK 'num64=-1'375OK 'num64=-1'
376Setting options string 'num64=-2'376Setting options string 'num64=-2'
377Setting entry with key 'num64' to value '-2'377Setting entry with key 'num64' to value '-2'
378Value -2.000000 for parameter 'num64' out of range [-1 - 100]378Value -2.000000 for parameter 'num64' out of range [-1 - 4.29497e+09]
379Error 'num64=-2'379Error 'num64=-2'
380Setting options string 'num64=101'380Setting options string 'num64=4294967296'
381Setting entry with key 'num64' to value '101'381Setting entry with key 'num64' to value '4294967296'
382Value 101.000000 for parameter 'num64' out of range [-1 - 100]382OK 'num64=4294967296'
383Error 'num64=101'383Setting options string 'num64=4294967297'
384Setting entry with key 'num64' to value '4294967297'
385Value 4294967297.000000 for parameter 'num64' out of range [-1 - 4.29497e+09]
386Error 'num64=4294967297'
384Setting options string 'flt=bogus'387Setting options string 'flt=bogus'
385Setting entry with key 'flt' to value 'bogus'388Setting entry with key 'flt' to value 'bogus'
386Undefined constant or missing '(' in 'bogus'389Undefined 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