@@ -9,7 +9,7 @@ mod test {
99 fn snprintf ( buf : * mut CChar , len : usize , fmt : * const CChar , ...) -> i32 ;
1010 }
1111
12- use crate :: { strcmp:: strcmp, CChar } ;
12+ use crate :: { strcmp:: strcmp, CChar , CInt , CLong , CLongLong , CUInt , CULong , CULongLong } ;
1313
1414 #[ test]
1515 fn plain_string ( ) {
@@ -66,7 +66,6 @@ mod test {
6666 }
6767
6868 #[ test]
69- #[ cfg( feature = "lp64" ) ]
7069 fn numbers ( ) {
7170 let mut buf = [ b'\0' ; 64 ] ;
7271 assert_eq ! (
@@ -75,49 +74,15 @@ mod test {
7574 buf. as_mut_ptr( ) ,
7675 buf. len( ) ,
7776 "%u %lu %llu %d %ld %lld %x %lx %llX\0 " . as_ptr( ) ,
78- 100u32 ,
79- 100u64 ,
80- 100u64 ,
81- -100i32 ,
82- -100i64 ,
83- -100i64 ,
84- 0xcafe1234u32 ,
85- 0xcafe1234u64 ,
86- 0xcafe1234u64 ,
87- )
88- } ,
89- 53
90- ) ;
91- assert_eq ! (
92- unsafe {
93- strcmp(
94- buf. as_ptr( ) as * const u8 ,
95- b"100 100 100 -100 -100 -100 cafe1234 cafe1234 CAFE1234\0 " as * const u8 ,
96- )
97- } ,
98- 0
99- ) ;
100- }
101-
102- #[ test]
103- #[ cfg( not( feature = "lp64" ) ) ]
104- fn numbers ( ) {
105- let mut buf = [ b'\0' ; 64 ] ;
106- assert_eq ! (
107- unsafe {
108- snprintf(
109- buf. as_mut_ptr( ) ,
110- buf. len( ) ,
111- "%u %lu %llu %d %ld %lld %x %lx %llX\0 " . as_ptr( ) ,
112- 100u32 ,
113- 100u32 ,
114- 100u64 ,
115- -100i32 ,
116- -100i32 ,
117- -100i64 ,
118- 0xcafe1234u32 ,
119- 0xcafe1234u64 ,
120- 0xcafe1234u64 ,
77+ CUInt :: from( 100u8 ) ,
78+ CULong :: from( 100u8 ) ,
79+ CULongLong :: from( 100u8 ) ,
80+ CInt :: from( -100i8 ) ,
81+ CLong :: from( -100i8 ) ,
82+ CLongLong :: from( -100i8 ) ,
83+ CUInt :: from( 0xcafe1234u32 ) ,
84+ CULong :: from( 0xcafe1234u32 ) ,
85+ CULongLong :: from( 0xcafe1234u32 ) ,
12186 )
12287 } ,
12388 53
0 commit comments