mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 06:46:32 +03:00
add create_context() function
This commit is contained in:
@@ -4467,18 +4467,20 @@ unsafe fn stress_functions(context: &dc_context_t) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn cb(
|
#[cfg(test)]
|
||||||
_context: &dc_context_t,
|
mod tests {
|
||||||
_event: Event,
|
use super::*;
|
||||||
_data1: uintptr_t,
|
|
||||||
_data2: uintptr_t,
|
|
||||||
) -> uintptr_t {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
unsafe extern "C" fn cb(
|
||||||
fn run_stress_tests() {
|
_context: &dc_context_t,
|
||||||
unsafe {
|
_event: Event,
|
||||||
|
_data1: uintptr_t,
|
||||||
|
_data2: uintptr_t,
|
||||||
|
) -> uintptr_t {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn create_context() -> dc_context_t {
|
||||||
let mut ctx = dc_context_new(cb, std::ptr::null_mut(), std::ptr::null_mut());
|
let mut ctx = dc_context_new(cb, std::ptr::null_mut(), std::ptr::null_mut());
|
||||||
let dir = tempdir().unwrap();
|
let dir = tempdir().unwrap();
|
||||||
let dbfile = CString::new(dir.path().join("db.sqlite").to_str().unwrap()).unwrap();
|
let dbfile = CString::new(dir.path().join("db.sqlite").to_str().unwrap()).unwrap();
|
||||||
@@ -4491,6 +4493,14 @@ fn run_stress_tests() {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
);
|
);
|
||||||
|
|
||||||
stress_functions(&ctx)
|
ctx
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn run_stress_tests() {
|
||||||
|
unsafe {
|
||||||
|
let ctx = create_context();
|
||||||
|
stress_functions(&ctx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user