mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
test: move dc_atof/dc_ftoa tests to dc_tools.rs
This commit is contained in:
@@ -1704,4 +1704,23 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_atof() {
|
||||||
|
unsafe {
|
||||||
|
let f: libc::c_double = dc_atof(b"1.23\x00" as *const u8 as *const libc::c_char);
|
||||||
|
assert!(f > 1.22f64);
|
||||||
|
assert!(f < 1.24f64);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_ftoa() {
|
||||||
|
unsafe {
|
||||||
|
let s: *mut libc::c_char = dc_ftoa(1.23f64);
|
||||||
|
assert!(dc_atof(s) > 1.22f64);
|
||||||
|
assert!(dc_atof(s) < 1.24f64);
|
||||||
|
free(s as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -544,29 +544,6 @@ unsafe fn stress_functions(context: &dc_context_t) {
|
|||||||
} else {
|
} else {
|
||||||
};
|
};
|
||||||
free(mime_0 as *mut libc::c_void);
|
free(mime_0 as *mut libc::c_void);
|
||||||
let f: libc::c_double = dc_atof(b"1.23\x00" as *const u8 as *const libc::c_char);
|
|
||||||
if 0 != !(f > 1.22f64 && f < 1.24f64) as libc::c_int as libc::c_long {
|
|
||||||
__assert_rtn(
|
|
||||||
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
|
|
||||||
.as_ptr(),
|
|
||||||
b"../cmdline/stress.c\x00" as *const u8 as *const libc::c_char,
|
|
||||||
374i32,
|
|
||||||
b"f>1.22 && f<1.24\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
let s: *mut libc::c_char = dc_ftoa(1.23f64);
|
|
||||||
if 0 != !(dc_atof(s) > 1.22f64 && dc_atof(s) < 1.24f64) as libc::c_int as libc::c_long {
|
|
||||||
__assert_rtn(
|
|
||||||
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
|
|
||||||
.as_ptr(),
|
|
||||||
b"../cmdline/stress.c\x00" as *const u8 as *const libc::c_char,
|
|
||||||
377i32,
|
|
||||||
b"dc_atof(s)>1.22 && dc_atof(s)<1.24\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(s as *mut libc::c_void);
|
|
||||||
|
|
||||||
let mut str: *mut libc::c_char = strdup(b"aaa\x00" as *const u8 as *const libc::c_char);
|
let mut str: *mut libc::c_char = strdup(b"aaa\x00" as *const u8 as *const libc::c_char);
|
||||||
let replacements: libc::c_int = dc_str_replace(
|
let replacements: libc::c_int = dc_str_replace(
|
||||||
|
|||||||
Reference in New Issue
Block a user