mirror of
https://github.com/falcosecurity/falco.git
synced 2025-08-29 11:13:19 +00:00
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:
parent
9bc28951ad
commit
08454dfa53
@ -74,4 +74,10 @@ 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);
|
||||
}
|
||||
|
@ -22,8 +22,6 @@ limitations under the License.
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
using token_timer = std::function<uint64_t()>;
|
||||
|
||||
// A simple token bucket that accumulates tokens at a fixed rate and allows
|
||||
// for limited bursting in the form of "banked" tokens.
|
||||
class token_bucket
|
||||
@ -79,4 +77,4 @@ class token_bucket
|
||||
// Nanoseconds since the epoch.
|
||||
//
|
||||
uint64_t m_last_seen;
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user