lte/gateway/c/session_manager/test/test_session_credit.cpp
// Assert that receiving an invalid GSU does not change the way we track
// credits. If we request an additional quota and receive an empty GSU, the
// quota should still be exhausted.
Assert that receiving an invalid GSU does not change the way we track
credits. If we request an additional quota and receive an empty GSU, the
quota should still be exhausted.
Assert that receiving an invalid GSU does not change the way we track credits . If we request an additional quota and receive an empty GSU the quota should still be exhausted .
TEST(test_is_quota_exhausted_after_empty_grant, test_session_credit) {
  SessionCredit credit;
  SessionCreditUpdateCriteria uc{};
  GrantedUnits gsu;
  uint64_t total_grant = 1000;
  create_granted_units(&total_grant, NULL, NULL, &gsu);
  credit.receive_credit(gsu, &uc);
  EXPECT_EQ(uc.grant_tracking_type, TOTAL_ONLY);
  credit.add_used_credit(900, 0, &uc);
  EXPECT_TRUE(credit.is_quota_exhausted(0.8));
  credit.mark_failure(0, &uc);
  gsu.Clear();
  credit.receive_credit(gsu, &uc);
  EXPECT_EQ(uc.grant_tracking_type, TOTAL_ONLY);
  EXPECT_TRUE(credit.is_quota_exhausted(0.8));
}
TEST ( test_is_quota_exhausted_after_empty_grant , test_session_credit ) { SessionCredit credit ; SessionCreditUpdateCriteria uc { } ; GrantedUnits gsu ; uint64_t total_grant = 1000 ; create_granted_units ( & total_grant , NULL , NULL , & gsu ) ; credit . receive_credit ( gsu , & uc ) ; EXPECT_EQ ( uc . grant_tracking_type , TOTAL_ONLY ) ; credit . add_used_credit ( 900 , 0 , & uc ) ; EXPECT_TRUE ( credit . is_quota_exhausted ( 0.8 ) ) ; credit . mark_failure ( 0 , & uc ) ; gsu . Clear ( ) ; credit . receive_credit ( gsu , & uc ) ; EXPECT_EQ ( uc . grant_tracking_type , TOTAL_ONLY ) ; EXPECT_TRUE ( credit . is_quota_exhausted ( 0.8 ) ) ; }
Assert that receiving an invalid GSU does not change the way we track
credits.
Assert that receiving an invalid GSU does not change the way we track credits .
// Add enough quota to hit is_quota_exhausted(0.8) // Receive empty GSU, quota should still be exhausted // assert uc grant_tracking type has not changed