/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: set ts=8 sts=2 et sw=2 tw=80:
*/ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Interruptible 100 second budget. This test will finish in well under that // time. static constexpr int64_t LONG_TIME = 100000;
SliceBudget budget = SliceBudget(TimeBudget(LONG_TIME), &wantInterrupt);
CHECK(!budget.isUnlimited());
CHECK(!budget.isWorkBudget());
CHECK(budget.isTimeBudget());
CHECK(budget.timeBudget() == LONG_TIME);
CHECK(!budget.isOverBudget());
// We do a little work, very small amount of time passes.
budget.step(500);
// Not enough work to check interrupt, and no interrupt anyway.
CHECK(!budget.isOverBudget());
// The external flag is not reset, but the budget will internally remember // that an interrupt was requested.
CHECK(wantInterrupt);
wantInterrupt = false;
CHECK(budget.isOverBudget());
// This doesn't test the deadline is correct as that would require waiting.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.