Skip to content

Commit

Permalink
Merge pull request #3616 from ChrisDenton/primitive
Browse files Browse the repository at this point in the history
Move testing of primitive types from std
  • Loading branch information
ChrisDenton authored Aug 12, 2024
2 parents d1df54e + d4da6c8 commit c8cc152
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 c8cc152

Please sign in to comment.