-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
/** | ||
* | ||
* Copyright 2016-2020 Netflix, Inc. | ||
* | ||
* Licensed under the BSD+Patent License (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://opensource.org/licenses/BSDplusPatent | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#include <getopt.h> | ||
|
||
#include "test.h" | ||
|
||
#include "cli_parse.h" | ||
|
||
static char *test_aom_ctc_v1_0() | ||
{ | ||
char *argv[7] = {"vmaf", "-r", "ref.y4m", "-d", "dis.y4m", "--aom_ctc", "v1.0"}; | ||
int argc = 7; | ||
CLISettings settings; | ||
optind = 1; | ||
cli_parse(argc, argv, &settings); | ||
mu_assert("cli_parse: --aom_ctc v1.0 provided but common_bitdepth enabled", !settings.common_bitdepth); | ||
mu_assert("cli_parse: --aom_ctc v1.0 provided but number of features is not 5", settings.feature_cnt == 5); | ||
mu_assert("cli_parse: --aom_ctc v1.0 provided but number of models is not 2", settings.model_cnt == 2); | ||
cli_free(&settings); | ||
|
||
return NULL; | ||
} | ||
|
||
static char *test_aom_ctc_v2_0() | ||
{ | ||
char *argv[7] = {"vmaf", "-r", "ref.y4m", "-d", "dis.y4m", "--aom_ctc", "v2.0"}; | ||
int argc = 7; | ||
CLISettings settings; | ||
optind = 1; | ||
cli_parse(argc, argv, &settings); | ||
mu_assert("cli_parse: --aom_ctc v2.0 provided but common_bitdepth enabled", !settings.common_bitdepth); | ||
mu_assert("cli_parse: --aom_ctc v2.0 provided but number of features is not 5", settings.feature_cnt == 5); | ||
mu_assert("cli_parse: --aom_ctc v2.0 provided but number of models is not 2", settings.model_cnt == 2); | ||
cli_free(&settings); | ||
|
||
return NULL; | ||
} | ||
|
||
static char *test_aom_ctc_v3_0() | ||
{ | ||
char *argv[7] = {"vmaf", "-r", "ref.y4m", "-d", "dis.y4m", "--aom_ctc", "v3.0"}; | ||
int argc = 7; | ||
CLISettings settings; | ||
optind = 1; | ||
cli_parse(argc, argv, &settings); | ||
mu_assert("cli_parse: --aom_ctc v3.0 provided but common_bitdepth enabled", !settings.common_bitdepth); | ||
mu_assert("cli_parse: --aom_ctc v3.0 provided but number of features is not 6", settings.feature_cnt == 6); | ||
mu_assert("cli_parse: --aom_ctc v3.0 provided but number of models is not 2", settings.model_cnt == 2); | ||
cli_free(&settings); | ||
|
||
return NULL; | ||
} | ||
|
||
static char *test_aom_ctc_v4_0() | ||
{ | ||
char *argv[7] = {"vmaf", "-r", "ref.y4m", "-d", "dis.y4m", "--aom_ctc", "v4.0"}; | ||
int argc = 7; | ||
CLISettings settings; | ||
optind = 1; | ||
cli_parse(argc, argv, &settings); | ||
mu_assert("cli_parse: --aom_ctc v4.0 provided but common_bitdepth enabled", !settings.common_bitdepth); | ||
mu_assert("cli_parse: --aom_ctc v4.0 provided but number of features is not 6", settings.feature_cnt == 6); | ||
mu_assert("cli_parse: --aom_ctc v4.0 provided but number of models is not 2", settings.model_cnt == 2); | ||
cli_free(&settings); | ||
|
||
return NULL; | ||
} | ||
|
||
static char *test_aom_ctc_v5_0() | ||
{ | ||
char *argv[7] = {"vmaf", "-r", "ref.y4m", "-d", "dis.y4m", "--aom_ctc", "v5.0"}; | ||
int argc = 7; | ||
CLISettings settings; | ||
optind = 1; | ||
cli_parse(argc, argv, &settings); | ||
mu_assert("cli_parse: --aom_ctc v5.0 provided but common_bitdepth enabled", !settings.common_bitdepth); | ||
mu_assert("cli_parse: --aom_ctc v5.0 provided but number of features is not 6", settings.feature_cnt == 6); | ||
mu_assert("cli_parse: --aom_ctc v5.0 provided but number of models is not 2", settings.model_cnt == 2); | ||
cli_free(&settings); | ||
|
||
return NULL; | ||
} | ||
|
||
static char *test_aom_ctc_v6_0() | ||
{ | ||
char *argv[7] = {"vmaf", "-r", "ref.y4m", "-d", "dis.y4m", "--aom_ctc", "v6.0"}; | ||
int argc = 7; | ||
CLISettings settings; | ||
optind = 1; | ||
cli_parse(argc, argv, &settings); | ||
mu_assert("cli_parse: --aom_ctc v6.0 provided but common_bitdepth not enabled", settings.common_bitdepth); | ||
mu_assert("cli_parse: --aom_ctc v6.0 provided but number of features is not 6", settings.feature_cnt == 6); | ||
mu_assert("cli_parse: --aom_ctc v6.0 provided but number of models is not 2", settings.model_cnt == 2); | ||
cli_free(&settings); | ||
|
||
return NULL; | ||
} | ||
|
||
static char *test_nflx_ctc_v1_0() | ||
{ | ||
char *argv[7] = {"vmaf", "-r", "ref.y4m", "-d", "dis.y4m", "--nflx_ctc", "v1.0"}; | ||
int argc = 7; | ||
CLISettings settings; | ||
optind = 1; | ||
cli_parse(argc, argv, &settings); | ||
mu_assert("cli_parse: --nflx_ctc v1.0 provided but common_bitdepth enabled", !settings.common_bitdepth); | ||
mu_assert("cli_parse: --nflx_ctc v1.0 provided but number of features is not 3", settings.feature_cnt == 3); | ||
mu_assert("cli_parse: --nflx_ctc v1.0 provided but number of models is not 2", settings.model_cnt == 2); | ||
cli_free(&settings); | ||
|
||
return NULL; | ||
} | ||
|
||
char *run_tests() | ||
{ | ||
mu_run_test(test_aom_ctc_v1_0); | ||
mu_run_test(test_aom_ctc_v2_0); | ||
mu_run_test(test_aom_ctc_v3_0); | ||
mu_run_test(test_aom_ctc_v4_0); | ||
mu_run_test(test_aom_ctc_v5_0); | ||
mu_run_test(test_aom_ctc_v6_0); | ||
mu_run_test(test_nflx_ctc_v1_0); | ||
return NULL; | ||
} |