mirror of https://github.com/lukechilds/cc-rs.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
720 B
61 lines
720 B
7 years ago
|
extern crate cc_test;
|
||
10 years ago
|
|
||
7 years ago
|
use cc_test::*;
|
||
10 years ago
|
|
||
9 years ago
|
#[link(name = "OptLinkage", kind = "static")]
|
||
8 years ago
|
extern "C" {
|
||
9 years ago
|
fn answer() -> i32;
|
||
9 years ago
|
}
|
||
|
|
||
10 years ago
|
#[test]
|
||
|
fn foo_here() {
|
||
|
unsafe {
|
||
|
assert_eq!(foo(), 4);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn bar_here() {
|
||
|
unsafe {
|
||
|
assert_eq!(bar1(), 5);
|
||
|
assert_eq!(bar2(), 6);
|
||
|
}
|
||
|
}
|
||
|
|
||
10 years ago
|
#[test]
|
||
|
fn asm_here() {
|
||
|
unsafe {
|
||
|
assert_eq!(asm(), 7);
|
||
|
}
|
||
|
}
|
||
10 years ago
|
|
||
|
#[test]
|
||
|
fn baz_here() {
|
||
|
unsafe {
|
||
|
assert_eq!(baz(), 8);
|
||
|
}
|
||
|
}
|
||
10 years ago
|
|
||
|
#[test]
|
||
|
#[cfg(windows)]
|
||
|
fn windows_here() {
|
||
|
unsafe {
|
||
|
windows();
|
||
|
}
|
||
|
}
|
||
10 years ago
|
|
||
|
#[test]
|
||
|
#[cfg(target_env = "msvc")]
|
||
|
fn msvc_here() {
|
||
|
unsafe {
|
||
|
msvc();
|
||
|
}
|
||
|
}
|
||
9 years ago
|
|
||
|
#[test]
|
||
|
fn opt_linkage() {
|
||
8 years ago
|
unsafe {
|
||
|
assert_eq!(answer(), 42);
|
||
|
}
|
||
9 years ago
|
}
|