Make Template to pass the default goals set for code coverage (#3198)

Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
This commit is contained in:
Anton Kolesnyk 2021-12-17 13:56:01 -08:00 committed by GitHub
parent f937eae89c
commit 5de42570e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

View File

@ -10,6 +10,7 @@ namespace Azure { namespace Template {
class TemplateClient final {
public:
std::string ClientVersion() const;
int GetValue(int key) const;
};
}} // namespace Azure::Template

View File

@ -11,3 +11,13 @@ using namespace Azure::Template;
using namespace Azure::Template::_detail;
std::string TemplateClient::ClientVersion() const { return PackageVersion::ToString(); }
int TemplateClient::GetValue(int key) const
{
if (key < 0)
{
return 0;
}
return key + 1;
}

View File

@ -13,3 +13,12 @@ TEST(Template, Basic)
EXPECT_FALSE(templateClient.ClientVersion().empty());
}
TEST(Template, GetValue)
{
TemplateClient templateClient;
EXPECT_EQ(templateClient.GetValue(-1), 0);
EXPECT_EQ(templateClient.GetValue(0), 1);
EXPECT_EQ(templateClient.GetValue(1), 2);
}

View File

@ -27,13 +27,6 @@ stages:
parameters:
ServiceDirectory: template
CtestRegex: azure-template
# The azure-template project has lower branch coverage than the default.
# This overrides the branch coverage floor until the issue can be
# addressed. Once it is addressed this line should be removed so that
# projects generated from this ci.yml file don't set a coverage target
# that is lower than the baseline defined in archetype-sdk-client.yml
# Issue: https://github.com/Azure/azure-sdk-for-cpp/issues/3022
BranchCoverageTarget: 33
Artifacts:
- Name: azure-template
Path: azure-template