Loading fastboot/fastboot.h +1 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ void syntax_error(const char* fmt, ...); std::string get_current_slot(); // Code for Parsing fastboot-info.txt bool CheckFastbootInfoRequirements(const std::vector<std::string>& command); std::unique_ptr<FlashTask> ParseFlashCommand(const FlashingPlan* fp, const std::vector<std::string>& parts); std::unique_ptr<RebootTask> ParseRebootCommand(const FlashingPlan* fp, Loading fastboot/task_test.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -80,3 +80,21 @@ TEST_F(ParseTest, CORRECT_FlASH_TASK_FORMED) { ASSERT_EQ(task->GetImageName(), expected_values[i][3]); } } TEST_F(ParseTest, VERSION_CHECK_CORRRECT) { std::vector<std::string> correct_versions = { "version 1.0", "version 22.00", }; std::vector<std::string> bad_versions = {"version", "version .01", "version x1", "version 1.0.1", "version 1.", "s 1.0", "version 1.0 2.0"}; for (auto& version : correct_versions) { ASSERT_TRUE(CheckFastbootInfoRequirements(android::base::Split(version, " "))) << version; } for (auto& version : bad_versions) { ASSERT_FALSE(CheckFastbootInfoRequirements(android::base::Split(version, " "))) << version; } } No newline at end of file Loading
fastboot/fastboot.h +1 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ void syntax_error(const char* fmt, ...); std::string get_current_slot(); // Code for Parsing fastboot-info.txt bool CheckFastbootInfoRequirements(const std::vector<std::string>& command); std::unique_ptr<FlashTask> ParseFlashCommand(const FlashingPlan* fp, const std::vector<std::string>& parts); std::unique_ptr<RebootTask> ParseRebootCommand(const FlashingPlan* fp, Loading
fastboot/task_test.cpp +18 −0 Original line number Diff line number Diff line Loading @@ -80,3 +80,21 @@ TEST_F(ParseTest, CORRECT_FlASH_TASK_FORMED) { ASSERT_EQ(task->GetImageName(), expected_values[i][3]); } } TEST_F(ParseTest, VERSION_CHECK_CORRRECT) { std::vector<std::string> correct_versions = { "version 1.0", "version 22.00", }; std::vector<std::string> bad_versions = {"version", "version .01", "version x1", "version 1.0.1", "version 1.", "s 1.0", "version 1.0 2.0"}; for (auto& version : correct_versions) { ASSERT_TRUE(CheckFastbootInfoRequirements(android::base::Split(version, " "))) << version; } for (auto& version : bad_versions) { ASSERT_FALSE(CheckFastbootInfoRequirements(android::base::Split(version, " "))) << version; } } No newline at end of file