summaryrefslogtreecommitdiff
path: root/src/lib.rs
blob: a179da8c7d97e06e06a6e04ccdd011039ab71c51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

mod ffi;

pub use crate::ffi::*;

#[cfg(test)]
mod tests {
    use super::*;
    use std::ffi::CString;

    #[test]
    fn login_auto() {
        unsafe {
            assert_eq!(0, NK_login_auto());
        }
    }

    #[test]
    fn login() {
        unsafe {
            // Unconnected
            assert_eq!(0, NK_login(CString::new("S").unwrap().as_ptr()));
            assert_eq!(0, NK_login(CString::new("P").unwrap().as_ptr()));
            // Unsupported model
            assert_eq!(0, NK_login(CString::new("T").unwrap().as_ptr()));
        }
    }
}