diff options
author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-11-18 02:41:20 +1100 |
---|---|---|
committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-11-18 02:47:35 +1100 |
commit | 0a48d3e5826124ac98adaba024219107daf5abfd (patch) | |
tree | 34ad32b85666c431bd0b66dc0f0551d122a9a433 | |
parent | e98a168d49541f934b19d61a981617ca658b9b2f (diff) |
Add test
-rw-r--r-- | tests/cmath.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/cmath.rs b/tests/cmath.rs new file mode 100644 index 00000000..477184b7 --- /dev/null +++ b/tests/cmath.rs @@ -0,0 +1,20 @@ +#![feature(phase)] + +#[phase(plugin)] +extern crate bindgen; + +#[allow(dead_code)] +#[allow(non_snake_case)] +#[allow(non_camel_case_types)] +#[allow(non_upper_case_globals)] +pub mod ffi { + bindgen!("math.h", link = "m") +} + +fn main() { + unsafe { + assert_eq!(ffi::floor( 2.7), 2.0); + assert_eq!(ffi::floor(-2.7), -3.0); + assert_eq!(ffi::floor(-0.0), 0.0); + } +} |