@@ -5,6 +5,8 @@ use crate::isdbs::isdbs::*;
5
5
#[ cfg( test) ]
6
6
mod tests {
7
7
use super :: * ;
8
+ use std:: ffi:: CString ;
9
+ use std:: ptr;
8
10
9
11
#[ test]
10
12
fn test_layout_get_height_horizontal_960x540 ( ) {
@@ -80,11 +82,6 @@ mod tests {
80
82
fn test_layout_get_width_default ( ) {
81
83
assert_eq ! ( layout_get_width( WritingFormat :: None ) , 720 ) ;
82
84
}
83
- }
84
-
85
- #[ cfg( test) ]
86
- mod tests {
87
- use super :: * ;
88
85
89
86
#[ test]
90
87
fn test_isdb_set_global_time ( ) {
@@ -221,12 +218,6 @@ mod tests {
221
218
assert_eq ! ( list_head. prev, & mut list_head as * mut _) ;
222
219
}
223
220
}
224
- }
225
-
226
- #[ cfg( test) ]
227
- mod tests {
228
- use super :: * ;
229
- use std:: ptr;
230
221
231
222
#[ test]
232
223
fn test_free ( ) {
@@ -265,10 +256,7 @@ mod tests {
265
256
assert ! ( ptr. is_null( ) ) ;
266
257
}
267
258
}
268
- }
269
259
270
- #[ cfg( test) ]
271
- mod tests {
272
260
use super :: * ;
273
261
use std:: ptr;
274
262
@@ -389,10 +377,7 @@ mod tests {
389
377
assert_eq ! ( head. next, & mut node2) ;
390
378
}
391
379
}
392
- }
393
380
394
- #[ cfg( test) ]
395
- mod tests {
396
381
use super :: * ;
397
382
use std:: ptr;
398
383
@@ -490,12 +475,6 @@ mod tests {
490
475
let offset = unsafe { ccx_offsetof ( b"list\0 " . as_ptr ( ) ) } ;
491
476
assert_eq ! ( offset, std:: mem:: offset_of!( ISDBText , list) ) ;
492
477
}
493
- }
494
-
495
- #[ cfg( test) ]
496
- mod tests {
497
- use super :: * ;
498
- use std:: ptr;
499
478
500
479
#[ test]
501
480
fn test_delete_isdb_decoder_empty ( ) {
@@ -570,7 +549,7 @@ mod tests {
570
549
}
571
550
572
551
#[ test]
573
- fn test_delete_isdb_decoder_with_entries ( ) {
552
+ unsafe fn test_delete_isdb_decoder_with_entries ( ) {
574
553
let mut ctx = ISDBSubContext {
575
554
text_list_head : ListHead {
576
555
next : ptr:: null_mut ( ) ,
@@ -641,10 +620,7 @@ mod tests {
641
620
assert_eq ! ( ctx. buffered_text. prev, & mut ctx. buffered_text as * mut _) ;
642
621
}
643
622
}
644
- }
645
623
646
- #[ cfg( test) ]
647
- mod tests {
648
624
use super :: * ;
649
625
use std:: fmt:: Write ;
650
626
@@ -656,10 +632,7 @@ mod tests {
656
632
// Since isdb_log does nothing, there's nothing to assert here.
657
633
// This test ensures that the function can be called without errors.
658
634
}
659
- }
660
635
661
- #[ cfg( test) ]
662
- mod tests {
663
636
use super :: * ;
664
637
use std:: alloc:: { alloc, dealloc, Layout } ;
665
638
@@ -708,22 +681,19 @@ mod tests {
708
681
timestamp : 0 ,
709
682
refcount : 0 ,
710
683
} ;
711
-
684
+
712
685
unsafe {
713
686
assert_eq ! ( reserve_buf( & mut text, 100 ) , 0 ) ;
714
687
assert_eq ! ( text. len, 128 ) ;
715
-
688
+
716
689
assert_eq ! ( reserve_buf( & mut text, 200 ) , 0 ) ;
717
690
assert ! ( text. len >= 328 ) ;
718
-
691
+
719
692
let layout = Layout :: from_size_align ( text. len , 1 ) . unwrap ( ) ;
720
693
dealloc ( text. buf as * mut u8 , layout) ;
721
694
}
722
695
}
723
- }
724
696
725
- #[ cfg( test) ]
726
- mod tests {
727
697
use super :: * ;
728
698
use std:: ptr;
729
699
@@ -813,13 +783,6 @@ mod tests {
813
783
assert_eq ! ( count, 2 ) ;
814
784
}
815
785
}
816
- }
817
-
818
- #[ cfg( test) ]
819
- mod tests {
820
- use super :: * ;
821
- use std:: ffi:: CString ;
822
- use std:: ptr;
823
786
824
787
#[ test]
825
788
fn test_append_char ( ) {
@@ -907,13 +870,6 @@ mod tests {
907
870
908
871
assert ! ( list_empty( & head) ) ;
909
872
}
910
- }
911
-
912
- #[ cfg( test) ]
913
- mod tests {
914
- use super :: * ;
915
- use std:: ffi:: CString ;
916
- use std:: ptr;
917
873
918
874
#[ test]
919
875
fn test_append_char ( ) {
@@ -1133,12 +1089,6 @@ mod tests {
1133
1089
WritingFormat :: HorizontalStdDensity
1134
1090
) ;
1135
1091
}
1136
- }
1137
-
1138
- #[ cfg( test) ]
1139
- mod tests {
1140
- use super :: * ;
1141
- use std:: ptr;
1142
1092
1143
1093
#[ test]
1144
1094
fn test_move_penpos ( ) {
@@ -1349,12 +1299,6 @@ mod tests {
1349
1299
WritingFormat :: HorizontalStdDensity
1350
1300
) ;
1351
1301
}
1352
- }
1353
-
1354
- #[ cfg( test) ]
1355
- mod tests {
1356
- use super :: * ;
1357
- use std:: ptr;
1358
1302
1359
1303
#[ test]
1360
1304
fn test_parse_command ( ) {
@@ -1489,15 +1433,6 @@ mod tests {
1489
1433
assert_eq ! ( ctx. nb_lang, 1 ) ;
1490
1434
assert_eq ! ( ctx. dmf, 0x10 ) ;
1491
1435
}
1492
- }
1493
-
1494
- /* -------------------------- */
1495
-
1496
- #[ cfg( test) ]
1497
- mod tests {
1498
- use super :: * ;
1499
- use std:: ffi:: CString ;
1500
- use std:: ptr;
1501
1436
1502
1437
#[ test]
1503
1438
fn test_add_cc_sub_text ( ) {
@@ -1540,14 +1475,6 @@ mod tests {
1540
1475
assert_eq ! ( sub. mode, [ 109 , 111 , 100 , 101 , 0 ] ) ; // "mode" in ASCII
1541
1476
assert_eq ! ( sub. got_output, 1 ) ;
1542
1477
}
1543
- }
1544
-
1545
- /* -------------------------- */
1546
-
1547
- #[ cfg( test) ]
1548
- mod tests {
1549
- use super :: * ;
1550
- use std:: ptr;
1551
1478
1552
1479
#[ test]
1553
1480
fn test_parse_statement ( ) {
0 commit comments