Skip to content

Commit 77f5eb4

Browse files
committed
tests 1
1 parent fd1fad8 commit 77f5eb4

File tree

1 file changed

+6
-79
lines changed

1 file changed

+6
-79
lines changed

src/rust/lib_ccxr/src/isdbs/tests.rs

Lines changed: 6 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use crate::isdbs::isdbs::*;
55
#[cfg(test)]
66
mod tests {
77
use super::*;
8+
use std::ffi::CString;
9+
use std::ptr;
810

911
#[test]
1012
fn test_layout_get_height_horizontal_960x540() {
@@ -80,11 +82,6 @@ mod tests {
8082
fn test_layout_get_width_default() {
8183
assert_eq!(layout_get_width(WritingFormat::None), 720);
8284
}
83-
}
84-
85-
#[cfg(test)]
86-
mod tests {
87-
use super::*;
8885

8986
#[test]
9087
fn test_isdb_set_global_time() {
@@ -221,12 +218,6 @@ mod tests {
221218
assert_eq!(list_head.prev, &mut list_head as *mut _);
222219
}
223220
}
224-
}
225-
226-
#[cfg(test)]
227-
mod tests {
228-
use super::*;
229-
use std::ptr;
230221

231222
#[test]
232223
fn test_free() {
@@ -265,10 +256,7 @@ mod tests {
265256
assert!(ptr.is_null());
266257
}
267258
}
268-
}
269259

270-
#[cfg(test)]
271-
mod tests {
272260
use super::*;
273261
use std::ptr;
274262

@@ -389,10 +377,7 @@ mod tests {
389377
assert_eq!(head.next, &mut node2);
390378
}
391379
}
392-
}
393380

394-
#[cfg(test)]
395-
mod tests {
396381
use super::*;
397382
use std::ptr;
398383

@@ -490,12 +475,6 @@ mod tests {
490475
let offset = unsafe { ccx_offsetof(b"list\0".as_ptr()) };
491476
assert_eq!(offset, std::mem::offset_of!(ISDBText, list));
492477
}
493-
}
494-
495-
#[cfg(test)]
496-
mod tests {
497-
use super::*;
498-
use std::ptr;
499478

500479
#[test]
501480
fn test_delete_isdb_decoder_empty() {
@@ -570,7 +549,7 @@ mod tests {
570549
}
571550

572551
#[test]
573-
fn test_delete_isdb_decoder_with_entries() {
552+
unsafe fn test_delete_isdb_decoder_with_entries() {
574553
let mut ctx = ISDBSubContext {
575554
text_list_head: ListHead {
576555
next: ptr::null_mut(),
@@ -641,10 +620,7 @@ mod tests {
641620
assert_eq!(ctx.buffered_text.prev, &mut ctx.buffered_text as *mut _);
642621
}
643622
}
644-
}
645623

646-
#[cfg(test)]
647-
mod tests {
648624
use super::*;
649625
use std::fmt::Write;
650626

@@ -656,10 +632,7 @@ mod tests {
656632
// Since isdb_log does nothing, there's nothing to assert here.
657633
// This test ensures that the function can be called without errors.
658634
}
659-
}
660635

661-
#[cfg(test)]
662-
mod tests {
663636
use super::*;
664637
use std::alloc::{alloc, dealloc, Layout};
665638

@@ -708,22 +681,19 @@ mod tests {
708681
timestamp: 0,
709682
refcount: 0,
710683
};
711-
684+
712685
unsafe {
713686
assert_eq!(reserve_buf(&mut text, 100), 0);
714687
assert_eq!(text.len, 128);
715-
688+
716689
assert_eq!(reserve_buf(&mut text, 200), 0);
717690
assert!(text.len >= 328);
718-
691+
719692
let layout = Layout::from_size_align(text.len, 1).unwrap();
720693
dealloc(text.buf as *mut u8, layout);
721694
}
722695
}
723-
}
724696

725-
#[cfg(test)]
726-
mod tests {
727697
use super::*;
728698
use std::ptr;
729699

@@ -813,13 +783,6 @@ mod tests {
813783
assert_eq!(count, 2);
814784
}
815785
}
816-
}
817-
818-
#[cfg(test)]
819-
mod tests {
820-
use super::*;
821-
use std::ffi::CString;
822-
use std::ptr;
823786

824787
#[test]
825788
fn test_append_char() {
@@ -907,13 +870,6 @@ mod tests {
907870

908871
assert!(list_empty(&head));
909872
}
910-
}
911-
912-
#[cfg(test)]
913-
mod tests {
914-
use super::*;
915-
use std::ffi::CString;
916-
use std::ptr;
917873

918874
#[test]
919875
fn test_append_char() {
@@ -1133,12 +1089,6 @@ mod tests {
11331089
WritingFormat::HorizontalStdDensity
11341090
);
11351091
}
1136-
}
1137-
1138-
#[cfg(test)]
1139-
mod tests {
1140-
use super::*;
1141-
use std::ptr;
11421092

11431093
#[test]
11441094
fn test_move_penpos() {
@@ -1349,12 +1299,6 @@ mod tests {
13491299
WritingFormat::HorizontalStdDensity
13501300
);
13511301
}
1352-
}
1353-
1354-
#[cfg(test)]
1355-
mod tests {
1356-
use super::*;
1357-
use std::ptr;
13581302

13591303
#[test]
13601304
fn test_parse_command() {
@@ -1489,15 +1433,6 @@ mod tests {
14891433
assert_eq!(ctx.nb_lang, 1);
14901434
assert_eq!(ctx.dmf, 0x10);
14911435
}
1492-
}
1493-
1494-
/* -------------------------- */
1495-
1496-
#[cfg(test)]
1497-
mod tests {
1498-
use super::*;
1499-
use std::ffi::CString;
1500-
use std::ptr;
15011436

15021437
#[test]
15031438
fn test_add_cc_sub_text() {
@@ -1540,14 +1475,6 @@ mod tests {
15401475
assert_eq!(sub.mode, [109, 111, 100, 101, 0]); // "mode" in ASCII
15411476
assert_eq!(sub.got_output, 1);
15421477
}
1543-
}
1544-
1545-
/* -------------------------- */
1546-
1547-
#[cfg(test)]
1548-
mod tests {
1549-
use super::*;
1550-
use std::ptr;
15511478

15521479
#[test]
15531480
fn test_parse_statement() {

0 commit comments

Comments
 (0)