We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 400a99f commit 5ee1267Copy full SHA for 5ee1267
1 file changed
src/database/events.rs
@@ -51,6 +51,10 @@ impl EventsDb {
51
pub fn len(&self) -> usize {
52
self.events.read().unwrap().len()
53
}
54
+
55
+ pub fn is_empty(&self) -> bool {
56
+ self.events.read().unwrap().is_empty()
57
+ }
58
59
60
impl Default for EventsDb {
@@ -102,6 +106,8 @@ mod tests {
102
106
#[test]
103
107
fn test_events_db_filters_events_by_pid() {
104
108
let db = EventsDb::new().unwrap();
109
+ assert!(db.is_empty());
110
105
111
db.insert(SecurityEvent::Syscall(SyscallEvent::new(
112
42,
113
1000,
@@ -128,5 +134,6 @@ mod tests {
128
134
assert_eq!(pid_events.len(), 1);
129
135
assert_eq!(pid_events[0].pid(), Some(42));
130
136
assert_eq!(db.len(), 3);
137
+ assert!(!db.is_empty());
131
138
132
139
0 commit comments