Skip to content

Commit

Permalink
tests: Rename K01.FR.39 tests
Browse files Browse the repository at this point in the history
Tests for K01.FR.39 were previously mislabeled for K01.FR.06.

This commit relabels these tests.

Signed-off-by: Christopher Davis <[email protected]>
  • Loading branch information
christopher-davis-afs committed Apr 25, 2024
1 parent cf61700 commit 8f8a3ae
Showing 1 changed file with 53 additions and 61 deletions.
114 changes: 53 additions & 61 deletions tests/lib/ocpp/v201/test_smart_charging_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,67 +246,6 @@ TEST_F(ChargepointTestFixtureV201, K01FR09_IfTxProfileEvseHasNoActiveTransaction
EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::TxProfileEvseHasNoActiveTransaction));
}

TEST_F(ChargepointTestFixtureV201,
K01FR06_IfTxProfileHasSameTransactionAndStackLevelAsAnotherTxProfile_ThenProfileIsInvalid) {
create_evse_with_id(DEFAULT_EVSE_ID);
std::string transaction_id = uuid();
open_evse_transaction(DEFAULT_EVSE_ID, transaction_id);

auto same_stack_level = 42;
auto profile_1 = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile,
create_charge_schedule(ChargingRateUnitEnum::A), transaction_id,
ChargingProfileKindEnum::Absolute, same_stack_level);
auto profile_2 = create_charging_profile(DEFAULT_PROFILE_ID + 1, ChargingProfilePurposeEnum::TxProfile,
create_charge_schedule(ChargingRateUnitEnum::A), transaction_id,
ChargingProfileKindEnum::Absolute, same_stack_level);
handler.add_profile(DEFAULT_EVSE_ID, profile_2);
auto sut = handler.validate_tx_profile(profile_1, *evses[DEFAULT_EVSE_ID]);

EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::TxProfileConflictingStackLevel));
}

TEST_F(ChargepointTestFixtureV201,
K01FR06_IfTxProfileHasDifferentTransactionButSameStackLevelAsAnotherTxProfile_ThenProfileIsValid) {
create_evse_with_id(DEFAULT_EVSE_ID);
std::string transaction_id = uuid();
std::string different_transaction_id = uuid();
open_evse_transaction(DEFAULT_EVSE_ID, transaction_id);

auto same_stack_level = 42;
auto profile_1 = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile,
create_charge_schedule(ChargingRateUnitEnum::A), transaction_id,
ChargingProfileKindEnum::Absolute, same_stack_level);
auto profile_2 = create_charging_profile(DEFAULT_PROFILE_ID + 1, ChargingProfilePurposeEnum::TxProfile,
create_charge_schedule(ChargingRateUnitEnum::A), different_transaction_id,
ChargingProfileKindEnum::Absolute, same_stack_level);
handler.add_profile(DEFAULT_EVSE_ID, profile_2);
auto sut = handler.validate_tx_profile(profile_1, *evses[DEFAULT_EVSE_ID]);

EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid));
}

TEST_F(ChargepointTestFixtureV201,
K01FR06_IfTxProfileHasSameTransactionButDifferentStackLevelAsAnotherTxProfile_ThenProfileIsValid) {
create_evse_with_id(DEFAULT_EVSE_ID);
std::string same_transaction_id = uuid();
open_evse_transaction(DEFAULT_EVSE_ID, same_transaction_id);

auto stack_level_1 = 42;
auto stack_level_2 = 43;

auto profile_1 = create_charging_profile(DEFAULT_PROFILE_ID, ChargingProfilePurposeEnum::TxProfile,
create_charge_schedule(ChargingRateUnitEnum::A), same_transaction_id,
ChargingProfileKindEnum::Absolute, stack_level_1);
auto profile_2 = create_charging_profile(DEFAULT_PROFILE_ID + 1, ChargingProfilePurposeEnum::TxProfile,
create_charge_schedule(ChargingRateUnitEnum::A), same_transaction_id,
ChargingProfileKindEnum::Absolute, stack_level_2);

handler.add_profile(DEFAULT_EVSE_ID, profile_2);
auto sut = handler.validate_tx_profile(profile_1, *evses[DEFAULT_EVSE_ID]);

EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid));
}

TEST_F(ChargepointTestFixtureV201, K01FR19_NumberPhasesOtherThan1AndPhaseToUseSet_ThenProfileInvalid) {
auto periods = create_charging_schedule_periods_with_phases(0, 0, 1);
auto profile = create_charging_profile(
Expand Down Expand Up @@ -348,6 +287,59 @@ TEST_F(ChargepointTestFixtureV201, K01FR35_IfChargingSchedulePeriodsAreNotInChon
EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::ChargingSchedulePeriodsOutOfOrder));
}

TEST_F(ChargepointTestFixtureV201,
K01FR39_IfTxProfileHasSameTransactionAndStackLevelAsAnotherTxProfile_ThenProfileIsInvalid) {
create_evse_with_id(evse_id);
std::string transaction_id = uuid();
open_evse_transaction(evse_id, transaction_id);

auto same_stack_level = 42;
auto profile_1 =
create_tx_profile(create_charge_schedule(ChargingRateUnitEnum::A), transaction_id, same_stack_level);
auto profile_2 =
create_tx_profile(create_charge_schedule(ChargingRateUnitEnum::A), transaction_id, same_stack_level);
handler.add_profile(profile_2);
auto sut = handler.validate_tx_profile(profile_1, *evses[evse_id]);

EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::TxProfileConflictingStackLevel));
}

TEST_F(ChargepointTestFixtureV201,
K01FR39_IfTxProfileHasDifferentTransactionButSameStackLevelAsAnotherTxProfile_ThenProfileIsValid) {
create_evse_with_id(evse_id);
std::string transaction_id = uuid();
std::string different_transaction_id = uuid();
open_evse_transaction(evse_id, transaction_id);

auto same_stack_level = 42;
auto profile_1 =
create_tx_profile(create_charge_schedule(ChargingRateUnitEnum::A), transaction_id, same_stack_level);
auto profile_2 =
create_tx_profile(create_charge_schedule(ChargingRateUnitEnum::A), different_transaction_id, same_stack_level);
handler.add_profile(profile_2);
auto sut = handler.validate_tx_profile(profile_1, *evses[evse_id]);

EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid));
}

TEST_F(ChargepointTestFixtureV201,
K01FR39_IfTxProfileHasSameTransactionButDifferentStackLevelAsAnotherTxProfile_ThenProfileIsValid) {
create_evse_with_id(evse_id);
std::string same_transaction_id = uuid();
open_evse_transaction(evse_id, same_transaction_id);

auto stack_level_1 = 42;
auto stack_level_2 = 43;
auto profile_1 =
create_tx_profile(create_charge_schedule(ChargingRateUnitEnum::A), same_transaction_id, stack_level_1);
auto profile_2 =
create_tx_profile(create_charge_schedule(ChargingRateUnitEnum::A), same_transaction_id, stack_level_2);
handler.add_profile(profile_2);
auto sut = handler.validate_tx_profile(profile_1, *evses[evse_id]);

EXPECT_THAT(sut, testing::Eq(ProfileValidationResultEnum::Valid));
}

TEST_F(ChargepointTestFixtureV201,
K01FR40_IfChargingProfileKindIsAbsoluteAndStartScheduleDoesNotExist_ThenProfileIsInvalid) {
auto periods = create_charging_schedule_periods(0);
Expand Down

0 comments on commit 8f8a3ae

Please sign in to comment.