Generalise pointer width tests using pointer_width

This commit is contained in:
Richo Healey 2015-01-13 18:59:45 -08:00
parent 043a4b32d1
commit c51379386c

View file

@ -19,19 +19,14 @@ fn size_of_basic() {
}
#[test]
#[cfg(any(target_arch = "x86",
target_arch = "arm",
target_arch = "mips",
target_arch = "mipsel",
target_arch = "powerpc"))]
#[cfg(target_pointer_width = "32")]
fn size_of_32() {
assert_eq!(size_of::<uint>(), 4u);
assert_eq!(size_of::<*const uint>(), 4u);
}
#[test]
#[cfg(any(target_arch = "x86_64",
target_arch = "aarch64"))]
#[cfg(target_pointer_width = "64")]
fn size_of_64() {
assert_eq!(size_of::<uint>(), 8u);
assert_eq!(size_of::<*const uint>(), 8u);
@ -53,19 +48,14 @@ fn align_of_basic() {
}
#[test]
#[cfg(any(target_arch = "x86",
target_arch = "arm",
target_arch = "mips",
target_arch = "mipsel",
target_arch = "powerpc"))]
#[cfg(target_pointer_width = "32")]
fn align_of_32() {
assert_eq!(align_of::<uint>(), 4u);
assert_eq!(align_of::<*const uint>(), 4u);
}
#[test]
#[cfg(any(target_arch = "x86_64",
target_arch = "aarch64"))]
#[cfg(target_pointer_width = "64")]
fn align_of_64() {
assert_eq!(align_of::<uint>(), 8u);
assert_eq!(align_of::<*const uint>(), 8u);