-
Notifications
You must be signed in to change notification settings - Fork 0
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
7 changed files
with
236 additions
and
11 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
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
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,66 @@ | ||
#include <gtest/gtest.h> | ||
#include "arguments.h" | ||
#include "testutils/testdata.h" | ||
|
||
#include <filesystem> | ||
|
||
namespace vgraph { | ||
namespace consts { | ||
const std::filesystem::path full_conf = std::filesystem::path(TESTDATA_DIR) / "full.conf"; | ||
const std::filesystem::path partial_conf = std::filesystem::path(TESTDATA_DIR) / "partial.conf"; | ||
} | ||
|
||
//forward declaration because function under test is internal to cpp | ||
bool parse_config_file(const std::string& path, arguments& args); | ||
|
||
TEST(config_file_parsing_test, full_config_file) | ||
{ | ||
arguments args; | ||
|
||
EXPECT_TRUE(parse_config_file(consts::full_conf, args)); | ||
|
||
EXPECT_TRUE(args.debug); | ||
EXPECT_TRUE(args.gpu); | ||
EXPECT_TRUE(args.timecode); | ||
EXPECT_TRUE(args.alignment_mode); | ||
EXPECT_EQ("/some/absolute/path", args.telemetry); | ||
EXPECT_EQ("./a/different/relative/path", args.layout); | ||
EXPECT_EQ("mp4_file.mp4", args.input); | ||
EXPECT_EQ("/absolute/mp4/file.mp4", args.output); | ||
EXPECT_EQ(100000, args.bitrate); | ||
|
||
ASSERT_TRUE(args.resolution); | ||
EXPECT_EQ(1234, args.resolution->first); | ||
EXPECT_EQ(567, args.resolution->second); | ||
|
||
ASSERT_TRUE(args.offset); | ||
EXPECT_NEAR(123.456, *args.offset, 0.001); | ||
|
||
ASSERT_TRUE(args.clip_time); | ||
EXPECT_NEAR(60, *args.clip_time, 0.001); | ||
} | ||
|
||
TEST(config_file_parsing_test, partial_config_file) | ||
{ | ||
arguments args; | ||
|
||
EXPECT_TRUE(parse_config_file(consts::partial_conf, args)); | ||
|
||
EXPECT_FALSE(args.debug); | ||
EXPECT_TRUE(args.gpu); | ||
EXPECT_FALSE(args.timecode); | ||
EXPECT_FALSE(args.alignment_mode); | ||
EXPECT_EQ("./test/testdata/correct.fit", args.telemetry); | ||
EXPECT_EQ("./test/testdata/layout.xml", args.layout); | ||
EXPECT_FALSE(args.input); | ||
EXPECT_FALSE(args.output); | ||
EXPECT_EQ(80000, args.bitrate); | ||
EXPECT_FALSE(args.offset); | ||
EXPECT_FALSE(args.clip_time); | ||
|
||
ASSERT_TRUE(args.resolution); | ||
EXPECT_EQ(3840, args.resolution->first); | ||
EXPECT_EQ(2160, args.resolution->second); | ||
} | ||
|
||
} // namespace vgraph |
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,14 @@ | ||
#comment is ignored | ||
debug=true | ||
gpu=true | ||
timecode=true | ||
alignment=true | ||
telemetry=/some/absolute/path | ||
layout=./a/different/relative/path | ||
offset=123.456 | ||
input=mp4_file.mp4 | ||
output=/absolute/mp4/file.mp4 | ||
resolution=1234x567 | ||
bitrate=100000 | ||
clip_time=60 | ||
#comment is ignored |
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,12 @@ | ||
# debug=true | ||
gpu=true | ||
# timecode=true | ||
# alignment=true | ||
telemetry=./test/testdata/correct.fit | ||
layout=./test/testdata/layout.xml | ||
# offset=123.456 | ||
# input=mp4_file.mp4 | ||
# output=/absolute/mp4/file.mp4 | ||
resolution=3840x2160 | ||
bitrate=80000 | ||
# clip_time=60 |