@@ -557,3 +557,178 @@ fn iconv_UTF32LE_to_UTF16BE_conversion_without_c_flag() {
557557 Vec :: new ( ) ,
558558 ) ;
559559}
560+
561+ #[ test]
562+ fn iconv_UTF32BE_to_UTF8_conversion_without_c_flag ( ) {
563+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
564+
565+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf32be" ) ;
566+ let mut input: Vec < u8 > = Vec :: new ( ) ;
567+ File :: open ( & input_file)
568+ . unwrap ( )
569+ . read_to_end ( & mut input)
570+ . unwrap ( ) ;
571+
572+ let expected_output_file =
573+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf32be_to_utf8_without_c_flag" ) ;
574+
575+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
576+ File :: open ( & expected_output_file)
577+ . unwrap ( )
578+ . read_to_end ( & mut expected_output)
579+ . unwrap ( ) ;
580+
581+ iconv_test (
582+ & [ "-f" , "UTF-32BE" , "-t" , "UTF-8" ] ,
583+ input. clone ( ) ,
584+ expected_output. clone ( ) ,
585+ Vec :: new ( ) ,
586+ ) ;
587+
588+ iconv_test (
589+ & [ "-f" , "UTF-32BE" , "-t" , "UTF-8" , "-" ] ,
590+ input,
591+ expected_output,
592+ Vec :: new ( ) ,
593+ ) ;
594+ }
595+
596+ #[ test]
597+ fn iconv_UTF32BE_to_UTF32LE_conversion_without_c_flag ( ) {
598+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
599+
600+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf32be" ) ;
601+ let mut input: Vec < u8 > = Vec :: new ( ) ;
602+ File :: open ( & input_file)
603+ . unwrap ( )
604+ . read_to_end ( & mut input)
605+ . unwrap ( ) ;
606+
607+ let expected_output_file =
608+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf32be_to_utf32le_without_c_flag" ) ;
609+
610+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
611+ File :: open ( & expected_output_file)
612+ . unwrap ( )
613+ . read_to_end ( & mut expected_output)
614+ . unwrap ( ) ;
615+
616+ iconv_test (
617+ & [ "-f" , "UTF-32BE" , "-t" , "UTF-32LE" ] ,
618+ input. clone ( ) ,
619+ expected_output. clone ( ) ,
620+ Vec :: new ( ) ,
621+ ) ;
622+
623+ iconv_test (
624+ & [ "-f" , "UTF-32BE" , "-t" , "UTF-32LE" , "-" ] ,
625+ input,
626+ expected_output,
627+ Vec :: new ( ) ,
628+ ) ;
629+ }
630+
631+ #[ test]
632+ fn iconv_UTF32BE_to_ASCII_conversion_with_c_flag ( ) {
633+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
634+
635+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf32be" ) ;
636+ let mut input: Vec < u8 > = Vec :: new ( ) ;
637+ File :: open ( & input_file)
638+ . unwrap ( )
639+ . read_to_end ( & mut input)
640+ . unwrap ( ) ;
641+
642+ let expected_output_file =
643+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf32be_to_ascii_with_c_flag" ) ;
644+
645+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
646+ File :: open ( & expected_output_file)
647+ . unwrap ( )
648+ . read_to_end ( & mut expected_output)
649+ . unwrap ( ) ;
650+
651+ iconv_test (
652+ & [ "-c" , "-f" , "UTF-32BE" , "-t" , "ASCII" ] ,
653+ input. clone ( ) ,
654+ expected_output. clone ( ) ,
655+ Vec :: new ( ) ,
656+ ) ;
657+
658+ iconv_test (
659+ & [ "-c" , "-f" , "UTF-32BE" , "-t" , "ASCII" , "-" ] ,
660+ input,
661+ expected_output,
662+ Vec :: new ( ) ,
663+ ) ;
664+ }
665+
666+ #[ test]
667+ fn iconv_UTF32BE_to_UTF16LE_conversion_with_c_flag ( ) {
668+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
669+
670+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf32be" ) ;
671+ let mut input: Vec < u8 > = Vec :: new ( ) ;
672+ File :: open ( & input_file)
673+ . unwrap ( )
674+ . read_to_end ( & mut input)
675+ . unwrap ( ) ;
676+
677+ let expected_output_file =
678+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf32be_to_utf16le_without_c_flag" ) ;
679+
680+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
681+ File :: open ( & expected_output_file)
682+ . unwrap ( )
683+ . read_to_end ( & mut expected_output)
684+ . unwrap ( ) ;
685+
686+ iconv_test (
687+ & [ "-f" , "UTF-32BE" , "-t" , "UTF-16LE" ] ,
688+ input. clone ( ) ,
689+ expected_output. clone ( ) ,
690+ Vec :: new ( ) ,
691+ ) ;
692+
693+ iconv_test (
694+ & [ "-f" , "UTF-32BE" , "-t" , "UTF-16LE" , "-" ] ,
695+ input,
696+ expected_output,
697+ Vec :: new ( ) ,
698+ ) ;
699+ }
700+
701+ #[ test]
702+ fn iconv_UTF32BE_to_UTF16BE_conversion_with_c_flag ( ) {
703+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
704+
705+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf32be" ) ;
706+ let mut input: Vec < u8 > = Vec :: new ( ) ;
707+ File :: open ( & input_file)
708+ . unwrap ( )
709+ . read_to_end ( & mut input)
710+ . unwrap ( ) ;
711+
712+ let expected_output_file =
713+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf32be_to_utf16be_without_c_flag" ) ;
714+
715+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
716+ File :: open ( & expected_output_file)
717+ . unwrap ( )
718+ . read_to_end ( & mut expected_output)
719+ . unwrap ( ) ;
720+
721+ iconv_test (
722+ & [ "-f" , "UTF-32BE" , "-t" , "UTF-16BE" ] ,
723+ input. clone ( ) ,
724+ expected_output. clone ( ) ,
725+ Vec :: new ( ) ,
726+ ) ;
727+
728+ iconv_test (
729+ & [ "-f" , "UTF-32BE" , "-t" , "UTF-16BE" , "-" ] ,
730+ input,
731+ expected_output,
732+ Vec :: new ( ) ,
733+ ) ;
734+ }
0 commit comments