Skip to content

Commit

Permalink
Updated test for time precision issues
Browse files Browse the repository at this point in the history
Signed-off-by: Coury Richards <[email protected]>
  • Loading branch information
couryrr-afs committed Dec 27, 2023
1 parent 01830ad commit deb769e
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions tests/database_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,33 @@ TEST_F(DatabaseTest, test_insert_and_get_profiles) {
ASSERT_EQ(db_profile.chargingProfilePurpose, profile.chargingProfilePurpose);
ASSERT_EQ(db_profile.chargingProfileKind, profile.chargingProfileKind);
ASSERT_EQ(db_profile.recurrencyKind.value(), profile.recurrencyKind.value());
ASSERT_EQ(db_profile.validFrom.value(), profile.validFrom.value());
ASSERT_EQ(db_profile.validTo.value(), profile.validTo.value());

std::ostringstream profile_validFrom;
profile_validFrom << profile.validFrom.value();

std::ostringstream db_profile_validFrom;
db_profile_validFrom << db_profile.validFrom.value();

ASSERT_EQ(profile_validFrom.str(), db_profile_validFrom.str());

std::ostringstream profile_validTo;
profile_validTo << profile.validTo.value();

std::ostringstream db_profile_validTo;
db_profile_validTo << db_profile.validTo.value();

ASSERT_EQ(profile_validTo.str(), db_profile_validTo.str());

ASSERT_EQ(db_profile.chargingSchedule.chargingRateUnit, ChargingRateUnit::A);
ASSERT_EQ(db_profile.chargingSchedule.duration, profile.chargingSchedule.duration);
ASSERT_EQ(db_profile.chargingSchedule.startSchedule.value(), profile.chargingSchedule.startSchedule.value());

std::ostringstream profile_startSchedule;
profile_startSchedule << profile.chargingSchedule.startSchedule.value();

std::ostringstream db_profile_startSchedule;
db_profile_startSchedule << db_profile.chargingSchedule.startSchedule.value();

ASSERT_EQ(profile_startSchedule.str(), db_profile_startSchedule.str());
ASSERT_EQ(db_profile.chargingSchedule.minChargingRate.value(), profile.chargingSchedule.minChargingRate.value());

for (size_t i = 0; i < profile.chargingSchedule.chargingSchedulePeriod.size(); i++) {
Expand Down

0 comments on commit deb769e

Please sign in to comment.