mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
test: move tests to dc_tools.rs
This commit is contained in:
235
src/dc_tools.rs
235
src/dc_tools.rs
@@ -1723,4 +1723,239 @@ mod tests {
|
|||||||
free(s as *mut libc::c_void);
|
free(s as *mut libc::c_void);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_str_replace() {
|
||||||
|
unsafe {
|
||||||
|
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(
|
||||||
|
&mut str,
|
||||||
|
b"a\x00" as *const u8 as *const libc::c_char,
|
||||||
|
b"ab\x00" as *const u8 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
"ababab"
|
||||||
|
);
|
||||||
|
assert_eq!(replacements, 3);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_str_truncate_1() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char =
|
||||||
|
strdup(b"this is a little test string\x00" as *const u8 as *const libc::c_char);
|
||||||
|
dc_truncate_str(str, 16);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
"this is a [...]"
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_str_truncate_2() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char = strdup(b"1234\x00" as *const u8 as *const libc::c_char);
|
||||||
|
dc_truncate_str(str, 2);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
"1234"
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_str_truncate_3() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char = strdup(b"1234567\x00" as *const u8 as *const libc::c_char);
|
||||||
|
dc_truncate_str(str, 1);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
"1[...]"
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_str_truncate_4() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char = strdup(b"123456\x00" as *const u8 as *const libc::c_char);
|
||||||
|
dc_truncate_str(str, 4);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
"123456"
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_insert_breaks_1() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char = dc_insert_breaks(
|
||||||
|
b"just1234test\x00" as *const u8 as *const libc::c_char,
|
||||||
|
4,
|
||||||
|
b" \x00" as *const u8 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
"just 1234 test"
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_insert_breaks_2() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char = dc_insert_breaks(
|
||||||
|
b"just1234tes\x00" as *const u8 as *const libc::c_char,
|
||||||
|
4i32,
|
||||||
|
b"--\x00" as *const u8 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
"just--1234--tes"
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_insert_breaks_3() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char = dc_insert_breaks(
|
||||||
|
b"just1234t\x00" as *const u8 as *const libc::c_char,
|
||||||
|
4i32,
|
||||||
|
b"\x00" as *const u8 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
"just1234t"
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_insert_breaks_4() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char = dc_insert_breaks(
|
||||||
|
b"\x00" as *const u8 as *const libc::c_char,
|
||||||
|
4i32,
|
||||||
|
b"---\x00" as *const u8 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
""
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_null_terminate_1() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char =
|
||||||
|
dc_null_terminate(b"abcxyz\x00" as *const u8 as *const libc::c_char, 3);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
"abc"
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_null_terminate_2() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char =
|
||||||
|
dc_null_terminate(b"abcxyz\x00" as *const u8 as *const libc::c_char, 0);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
""
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_null_terminate_3() {
|
||||||
|
unsafe {
|
||||||
|
let str: *mut libc::c_char =
|
||||||
|
dc_null_terminate(0 as *const u8 as *const libc::c_char, 0);
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
""
|
||||||
|
);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_str_to_clist_1() {
|
||||||
|
unsafe {
|
||||||
|
let list: *mut clist = dc_str_to_clist(
|
||||||
|
0 as *const libc::c_char,
|
||||||
|
b" \x00" as *const u8 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
assert_eq!((*list).count, 0);
|
||||||
|
clist_free_content(list);
|
||||||
|
clist_free(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_str_to_clist_2() {
|
||||||
|
unsafe {
|
||||||
|
let list: *mut clist = dc_str_to_clist(
|
||||||
|
b"\x00" as *const u8 as *const libc::c_char,
|
||||||
|
b" \x00" as *const u8 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
assert_eq!((*list).count, 1);
|
||||||
|
clist_free_content(list);
|
||||||
|
clist_free(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_str_to_clist_3() {
|
||||||
|
unsafe {
|
||||||
|
let list: *mut clist = dc_str_to_clist(
|
||||||
|
b" \x00" as *const u8 as *const libc::c_char,
|
||||||
|
b" \x00" as *const u8 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
assert_eq!((*list).count, 2);
|
||||||
|
clist_free_content(list);
|
||||||
|
clist_free(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_str_to_clist_4() {
|
||||||
|
unsafe {
|
||||||
|
let list: *mut clist = dc_str_to_clist(
|
||||||
|
b"foo bar test\x00" as *const u8 as *const libc::c_char,
|
||||||
|
b" \x00" as *const u8 as *const libc::c_char,
|
||||||
|
);
|
||||||
|
assert_eq!((*list).count, 3);
|
||||||
|
let str: *mut libc::c_char =
|
||||||
|
dc_str_from_clist(list, b" \x00" as *const u8 as *const libc::c_char);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
CStr::from_ptr(str as *const libc::c_char).to_str().unwrap(),
|
||||||
|
"foo bar test"
|
||||||
|
);
|
||||||
|
|
||||||
|
clist_free_content(list);
|
||||||
|
clist_free(list);
|
||||||
|
free(str as *mut libc::c_void);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
288
tests/stress.rs
288
tests/stress.rs
@@ -414,294 +414,6 @@ unsafe fn stress_functions(context: &dc_context_t) {
|
|||||||
free(fn1 as *mut libc::c_void);
|
free(fn1 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 replacements: libc::c_int = dc_str_replace(
|
|
||||||
&mut str,
|
|
||||||
b"a\x00" as *const u8 as *const libc::c_char,
|
|
||||||
b"ab\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if 0 != !(strcmp(str, b"ababab\x00" as *const u8 as *const libc::c_char) == 0i32) 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,
|
|
||||||
396i32,
|
|
||||||
b"strcmp(str, \"ababab\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
if 0 != !(replacements == 3i32) 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,
|
|
||||||
397i32,
|
|
||||||
b"replacements == 3\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = strdup(b"this is a little test string\x00" as *const u8 as *const libc::c_char);
|
|
||||||
dc_truncate_str(str, 16i32);
|
|
||||||
if 0 != !(strcmp(
|
|
||||||
str,
|
|
||||||
b"this is a [...]\x00" as *const u8 as *const libc::c_char,
|
|
||||||
) == 0i32) 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,
|
|
||||||
402i32,
|
|
||||||
b"strcmp(str, \"this is a \" DC_EDITORIAL_ELLIPSE)==0\x00" as *const u8
|
|
||||||
as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = strdup(b"1234\x00" as *const u8 as *const libc::c_char);
|
|
||||||
dc_truncate_str(str, 2i32);
|
|
||||||
if 0 != !(strcmp(str, b"1234\x00" as *const u8 as *const libc::c_char) == 0i32) 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,
|
|
||||||
407i32,
|
|
||||||
b"strcmp(str, \"1234\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = strdup(b"1234567\x00" as *const u8 as *const libc::c_char);
|
|
||||||
dc_truncate_str(str, 1i32);
|
|
||||||
if 0 != !(strcmp(str, b"1[...]\x00" as *const u8 as *const libc::c_char) == 0i32) 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,
|
|
||||||
412i32,
|
|
||||||
b"strcmp(str, \"1[...]\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = strdup(b"123456\x00" as *const u8 as *const libc::c_char);
|
|
||||||
dc_truncate_str(str, 4i32);
|
|
||||||
if 0 != !(strcmp(str, b"123456\x00" as *const u8 as *const libc::c_char) == 0i32) 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,
|
|
||||||
417i32,
|
|
||||||
b"strcmp(str, \"123456\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = dc_insert_breaks(
|
|
||||||
b"just1234test\x00" as *const u8 as *const libc::c_char,
|
|
||||||
4i32,
|
|
||||||
b" \x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if 0 != !(strcmp(
|
|
||||||
str,
|
|
||||||
b"just 1234 test\x00" as *const u8 as *const libc::c_char,
|
|
||||||
) == 0i32) 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,
|
|
||||||
421i32,
|
|
||||||
b"strcmp(str, \"just 1234 test\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = dc_insert_breaks(
|
|
||||||
b"just1234tes\x00" as *const u8 as *const libc::c_char,
|
|
||||||
4i32,
|
|
||||||
b"--\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if 0 != !(strcmp(
|
|
||||||
str,
|
|
||||||
b"just--1234--tes\x00" as *const u8 as *const libc::c_char,
|
|
||||||
) == 0i32) 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,
|
|
||||||
425i32,
|
|
||||||
b"strcmp(str, \"just--1234--tes\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = dc_insert_breaks(
|
|
||||||
b"just1234t\x00" as *const u8 as *const libc::c_char,
|
|
||||||
4i32,
|
|
||||||
b"\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if 0 != !(strcmp(str, b"just1234t\x00" as *const u8 as *const libc::c_char) == 0i32)
|
|
||||||
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,
|
|
||||||
429i32,
|
|
||||||
b"strcmp(str, \"just1234t\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = dc_insert_breaks(
|
|
||||||
b"\x00" as *const u8 as *const libc::c_char,
|
|
||||||
4i32,
|
|
||||||
b"---\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if 0 != !(strcmp(str, b"\x00" as *const u8 as *const libc::c_char) == 0i32) 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,
|
|
||||||
433i32,
|
|
||||||
b"strcmp(str, \"\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = dc_null_terminate(b"abcxyz\x00" as *const u8 as *const libc::c_char, 3i32);
|
|
||||||
if 0 != !(strcmp(str, b"abc\x00" as *const u8 as *const libc::c_char) == 0i32) 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,
|
|
||||||
437i32,
|
|
||||||
b"strcmp(str, \"abc\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = dc_null_terminate(b"abcxyz\x00" as *const u8 as *const libc::c_char, 0i32);
|
|
||||||
if 0 != !(strcmp(str, b"\x00" as *const u8 as *const libc::c_char) == 0i32) 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,
|
|
||||||
441i32,
|
|
||||||
b"strcmp(str, \"\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
str = dc_null_terminate(0 as *const libc::c_char, 0i32);
|
|
||||||
if 0 != !(strcmp(str, b"\x00" as *const u8 as *const libc::c_char) == 0i32) 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,
|
|
||||||
445i32,
|
|
||||||
b"strcmp(str, \"\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
let mut list: *mut clist = dc_str_to_clist(
|
|
||||||
0 as *const libc::c_char,
|
|
||||||
b" \x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if 0 != !((*list).count == 0i32) 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,
|
|
||||||
449i32,
|
|
||||||
b"clist_count(list)==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
clist_free_content(list);
|
|
||||||
clist_free(list);
|
|
||||||
list = dc_str_to_clist(
|
|
||||||
b"\x00" as *const u8 as *const libc::c_char,
|
|
||||||
b" \x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if 0 != !((*list).count == 1i32) 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,
|
|
||||||
454i32,
|
|
||||||
b"clist_count(list)==1\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
clist_free_content(list);
|
|
||||||
clist_free(list);
|
|
||||||
list = dc_str_to_clist(
|
|
||||||
b" \x00" as *const u8 as *const libc::c_char,
|
|
||||||
b" \x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if 0 != !((*list).count == 2i32) 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,
|
|
||||||
459i32,
|
|
||||||
b"clist_count(list)==2\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
clist_free_content(list);
|
|
||||||
clist_free(list);
|
|
||||||
list = dc_str_to_clist(
|
|
||||||
b"foo bar test\x00" as *const u8 as *const libc::c_char,
|
|
||||||
b" \x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
if 0 != !((*list).count == 3i32) 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,
|
|
||||||
464i32,
|
|
||||||
b"clist_count(list)==3\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
str = dc_str_from_clist(list, b" \x00" as *const u8 as *const libc::c_char);
|
|
||||||
if 0 != !(strcmp(str, b"foo bar test\x00" as *const u8 as *const libc::c_char) == 0i32)
|
|
||||||
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,
|
|
||||||
466i32,
|
|
||||||
b"strcmp(str, \"foo bar test\")==0\x00" as *const u8 as *const libc::c_char,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
};
|
|
||||||
clist_free_content(list);
|
|
||||||
clist_free(list);
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
if 0 != !(strcmp(
|
if 0 != !(strcmp(
|
||||||
b"fresh=10\x00" as *const u8 as *const libc::c_char,
|
b"fresh=10\x00" as *const u8 as *const libc::c_char,
|
||||||
b"fresh=10\x00" as *const u8 as *const libc::c_char,
|
b"fresh=10\x00" as *const u8 as *const libc::c_char,
|
||||||
|
|||||||
Reference in New Issue
Block a user