new: test token bucket declaration triggers the default init

Co-Authored-By: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
This commit is contained in:
Leonardo Di Donato 2019-07-02 11:32:58 +00:00 committed by Lorenzo Fontana
parent 9bc28951ad
commit 08454dfa53
2 changed files with 8 additions and 4 deletions

View File

@ -75,3 +75,9 @@ TEST_CASE("token bucket with 2 tokens/sec rate, max 10 tokens", "[token_bucket]"
} }
} }
} }
TEST_CASE("token bucket default initialization", "[token_bucket]")
{
token_bucket tb;
REQUIRE(tb.get_tokens() == 1);
}

View File

@ -22,8 +22,6 @@ limitations under the License.
#include <cstdint> #include <cstdint>
#include <functional> #include <functional>
using token_timer = std::function<uint64_t()>;
// A simple token bucket that accumulates tokens at a fixed rate and allows // A simple token bucket that accumulates tokens at a fixed rate and allows
// for limited bursting in the form of "banked" tokens. // for limited bursting in the form of "banked" tokens.
class token_bucket class token_bucket