Skip to content

Commit

Permalink
Fix gh#149 : Rearranged tests for gtest for consistent results
Browse files Browse the repository at this point in the history
  • Loading branch information
kanjoe24 committed Dec 4, 2024
1 parent 433c118 commit 101afa0
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions tests/src/cpp_source/ut_test_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,18 @@ class UTKVPProfileTestL1 : public UTCore
}
};

TEST_F(UTKVPProfileTestL1, TestProfileGetInstance)
TEST_F(UTKVPProfileTestL1, TestProfileOpenSuccess)
{
// Getinstance from the profile passed via cli
ut_kvp_instance_t *instance = ut_kvp_profile_getInstance();
EXPECT_NE(instance, nullptr);
const char *validFileName = KVP_VALID_TEST_YAML_FILE;
ut_kvp_status_t status = ut_kvp_profile_open((char *)validFileName);
EXPECT_EQ(status, UT_KVP_STATUS_SUCCESS);
}

TEST_F(UTKVPProfileTestL1, TestProfileClose)
TEST_F(UTKVPProfileTestL1, TestProfileGetInstance)
{
// Getinstance from the profile passed via cli
ut_kvp_instance_t *instance = ut_kvp_profile_getInstance();
EXPECT_NE(instance, nullptr);

ut_kvp_profile_close();
ut_kvp_profile_close();
ut_kvp_profile_close();
// Since close doesn't return a status, we assume success if no exceptions were thrown.
SUCCEED();
}

TEST_F(UTKVPProfileTestL1, TestProfileOpenSuccess)
{
const char *validFileName = KVP_VALID_TEST_YAML_FILE;
ut_kvp_status_t status = ut_kvp_profile_open((char *)validFileName);
EXPECT_EQ(status, UT_KVP_STATUS_SUCCESS);
ut_kvp_profile_close();
}

TEST_F(UTKVPProfileTestL1, TestProfileOpenFailure)
Expand All @@ -77,7 +63,16 @@ TEST_F(UTKVPProfileTestL1, TestProfileOpenFailure)
// Test with a null file name.
status = ut_kvp_profile_open(nullptr);
EXPECT_EQ(status, UT_KVP_STATUS_INVALID_PARAM);
}

TEST_F(UTKVPProfileTestL1, TestProfileClose)
{
// Test profile close
ut_kvp_profile_close();
ut_kvp_profile_close();
ut_kvp_profile_close();
// Since close doesn't return a status, we assume success if no exceptions were thrown.
SUCCEED();
}

// Other test cases as needed...

0 comments on commit 101afa0

Please sign in to comment.