blob: 7c53aa8a66ae8aad59a9c0d391c7f3352797138f (
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
32
33
34
35
36
37
|
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#[cfg(not(feature = "bindgen"))]
mod ffi;
#[cfg(not(feature = "bindgen"))]
pub use crate::ffi::*;
#[cfg(feature = "bindgen")]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
#[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("L").unwrap().as_ptr()));
assert_eq!(0, NK_login(CString::new("P").unwrap().as_ptr()));
assert_eq!(0, NK_login(CString::new("S").unwrap().as_ptr()));
// Unsupported model
assert_eq!(0, NK_login(CString::new("T").unwrap().as_ptr()));
}
}
}
|