Skip to main content

llama_cpp_bindings/
ffi_status_is_ok.rs

1/// Returns true if the given status indicates success.
2#[must_use]
3pub const fn status_is_ok(status: llama_cpp_bindings_sys::llama_rs_status) -> bool {
4    status == llama_cpp_bindings_sys::LLAMA_RS_STATUS_OK
5}
6
7#[cfg(test)]
8mod tests {
9    use super::status_is_ok;
10
11    #[test]
12    fn ok_status() {
13        assert!(status_is_ok(llama_cpp_bindings_sys::LLAMA_RS_STATUS_OK));
14    }
15
16    #[test]
17    fn error_status() {
18        assert!(!status_is_ok(1));
19        assert!(!status_is_ok(-1));
20    }
21}