lte/gateway/c/session_manager/test/test_session_credit.cpp
// Default usage reporting threshold is 0.8, so session manager will report
// when quota is not completely used up.
Default usage reporting threshold is 0.8, so session manager will report
when quota is not completely used up.
Default usage reporting threshold is 0 . 8 so session manager will report when quota is not completely used up .
TEST(test_collect_updates_when_nearly_exhausted, test_session_credit) {
  SessionCredit credit;
  SessionCreditUpdateCriteria uc{};
  GrantedUnits gsu;
  uint64_t grant = 1000;
  create_granted_units(&grant, NULL, NULL, &gsu);
  credit.receive_credit(gsu, &uc);
  credit.add_used_credit(300, 500, &uc);
  EXPECT_TRUE(credit.is_quota_exhausted(0.8));
  RequestedUnits ru = credit.get_requested_credits_units();
  EXPECT_EQ(ru.total(), 800);
  auto update = credit.get_usage_for_reporting(&uc);
  EXPECT_EQ(update.bytes_tx, 300);
  EXPECT_EQ(update.bytes_rx, 500);
  EXPECT_TRUE(credit.is_reporting());
  EXPECT_TRUE(uc.reporting);
  EXPECT_EQ(credit.get_credit(REPORTING_TX), 300);
  EXPECT_EQ(credit.get_credit(REPORTING_RX), 500);
  EXPECT_EQ(uc.bucket_deltas[REPORTING_TX], 0);
  EXPECT_EQ(uc.bucket_deltas[REPORTING_RX], 0);
}
TEST ( test_collect_updates_when_nearly_exhausted , test_session_credit ) { SessionCredit credit ; SessionCreditUpdateCriteria uc { } ; GrantedUnits gsu ; uint64_t grant = 1000 ; create_granted_units ( & grant , NULL , NULL , & gsu ) ; credit . receive_credit ( gsu , & uc ) ; credit . add_used_credit ( 300 , 500 , & uc ) ; EXPECT_TRUE ( credit . is_quota_exhausted ( 0.8 ) ) ; RequestedUnits ru = credit . get_requested_credits_units ( ) ; EXPECT_EQ ( ru . total ( ) , 800 ) ; auto update = credit . get_usage_for_reporting ( & uc ) ; EXPECT_EQ ( update . bytes_tx , 300 ) ; EXPECT_EQ ( update . bytes_rx , 500 ) ; EXPECT_TRUE ( credit . is_reporting ( ) ) ; EXPECT_TRUE ( uc . reporting ) ; EXPECT_EQ ( credit . get_credit ( REPORTING_TX ) , 300 ) ; EXPECT_EQ ( credit . get_credit ( REPORTING_RX ) , 500 ) ; EXPECT_EQ ( uc . bucket_deltas [ REPORTING_TX ] , 0 ) ; EXPECT_EQ ( uc . bucket_deltas [ REPORTING_RX ] , 0 ) ; }
Default usage reporting threshold is 0.8, so session manager will report
when quota is not completely used up.
Default usage reporting threshold is 0 . 8 so session manager will report when quota is not completely used up .
// Only track how much has been reported. The currently reporting amount // should be held in memory only.