Skip to content

Commit

Permalink
Move testing of primitive types from std
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Aug 12, 2024
1 parent d1df54e commit d4da6c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ harness = true
name = "semver"
path = "test/semver.rs"
harness = false

[[test]]
name = "primitive_types"
path = "test/primitive_types.rs"
harness = true
15 changes: 15 additions & 0 deletions libc-test/test/primitive_types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::any::TypeId;

macro_rules! ok {
($($t:ident)*) => {$(
assert!(TypeId::of::<libc::$t>() == TypeId::of::<ffi::$t>(),
"{} is wrong", stringify!($t));
)*}
}

#[test]
fn same() {
use std::ffi;
ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong
c_longlong c_ulonglong c_float c_double);
}

0 comments on commit d4da6c8

Please sign in to comment.