mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-25 16:52:31 +00:00
avutil/tests/opt: test negative values for INT and INT64 types
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
2c77dc5aad
commit
72ac495960
@ -86,7 +86,7 @@ static const AVOptionArrayDef array_dict = {
|
||||
};
|
||||
|
||||
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 },
|
||||
@ -105,7 +105,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 },
|
||||
@ -380,10 +380,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",
|
||||
|
@ -24,7 +24,7 @@ array_dict[0]: k00 v\00
|
||||
array_dict[0]: k01 v,01
|
||||
array_dict[1]: k10 v=1:0
|
||||
TestContext AVOptions:
|
||||
-num <int> E.......... set num (from 0 to 100) (default 0)
|
||||
-num <int> E.......... set num (from -1 to 100) (default 0)
|
||||
-toggle <int> E.......... set toggle (from 0 to 1) (default 1)
|
||||
-rational <rational> E.......... set rational (from 0 to 10) (default 1/1)
|
||||
-string <string> E.......... set string (default "default")
|
||||
@ -43,7 +43,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 0 to 100) (default 1)
|
||||
-num64 <int64> E.......... set num 64bit (from -1 to 100) (default 1)
|
||||
-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)
|
||||
@ -337,6 +337,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'
|
||||
@ -350,11 +372,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'
|
||||
|
Loading…
Reference in New Issue
Block a user