#[cfg(test)]
mod tests {
use crate::ffi::VAPOURSYNTH_API_VERSION;
use crate::api::API;
use crate::core::{CoreCreationFlags, CoreRef};
fn setup_api() -> API {
API::get().expect("Failed to get VapourSynth API")
}
#[test]
fn test_api_version() {
let api = setup_api();
let version = api.version();
assert!(version >= VAPOURSYNTH_API_VERSION);
}
#[test]
fn test_api_singleton() {
let api1 = API::get().unwrap();
let api2 = API::get().unwrap();
assert_eq!(api1.version(), api2.version());
}
#[test]
fn test_cached_api() {
let api = API::get().unwrap();
let cached_api = unsafe { API::get_cached() };
assert_eq!(cached_api.version(), api.version());
}
#[test]
fn test_create_core() {
let _api = setup_api();
let _core = CoreRef::new(CoreCreationFlags::NONE);
}
#[test]
fn test_core_creation_with_flags() {
let _api = setup_api();
let _core1 = CoreRef::new(CoreCreationFlags::ENABLE_GRAPH_INSPECTION);
let _core2 = CoreRef::new(CoreCreationFlags::DISABLE_AUTO_LOADING);
let _core3 = CoreRef::new(
CoreCreationFlags::ENABLE_GRAPH_INSPECTION | CoreCreationFlags::DISABLE_AUTO_LOADING,
);
}
}