@@ -874,7 +874,7 @@ fn iconv_UTF16LE_to_UTF32LE_conversion_without_c_flag() {
874874}
875875
876876#[ test]
877- fn iconv_UTF16LE_to_UTF8_conversion_with_c_flag ( ) {
877+ fn iconv_UTF16LE_to_UTF8_conversion_without_c_flag ( ) {
878878 let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
879879
880880 let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf16le" ) ;
@@ -907,3 +907,178 @@ fn iconv_UTF16LE_to_UTF8_conversion_with_c_flag() {
907907 Vec :: new ( ) ,
908908 ) ;
909909}
910+
911+ #[ test]
912+ fn iconv_UTF16BE_to_UTF16LE_conversion_without_c_flag ( ) {
913+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
914+
915+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf16be" ) ;
916+ let mut input: Vec < u8 > = Vec :: new ( ) ;
917+ File :: open ( & input_file)
918+ . unwrap ( )
919+ . read_to_end ( & mut input)
920+ . unwrap ( ) ;
921+
922+ let expected_output_file =
923+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf16be_to_utf16le_without_c_flag" ) ;
924+
925+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
926+ File :: open ( & expected_output_file)
927+ . unwrap ( )
928+ . read_to_end ( & mut expected_output)
929+ . unwrap ( ) ;
930+
931+ iconv_test (
932+ & [ "-f" , "UTF-16BE" , "-t" , "UTF-16LE" ] ,
933+ input. clone ( ) ,
934+ expected_output. clone ( ) ,
935+ Vec :: new ( ) ,
936+ ) ;
937+
938+ iconv_test (
939+ & [ "-f" , "UTF-16BE" , "-t" , "UTF-16LE" , "-" ] ,
940+ input,
941+ expected_output,
942+ Vec :: new ( ) ,
943+ ) ;
944+ }
945+
946+ #[ test]
947+ fn iconv_UTF16BE_to_ASCII_conversion_with_c_flag ( ) {
948+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
949+
950+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf16be" ) ;
951+ let mut input: Vec < u8 > = Vec :: new ( ) ;
952+ File :: open ( & input_file)
953+ . unwrap ( )
954+ . read_to_end ( & mut input)
955+ . unwrap ( ) ;
956+
957+ let expected_output_file =
958+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf16be_to_ascii_with_c_flag" ) ;
959+
960+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
961+ File :: open ( & expected_output_file)
962+ . unwrap ( )
963+ . read_to_end ( & mut expected_output)
964+ . unwrap ( ) ;
965+
966+ iconv_test (
967+ & [ "-c" , "-f" , "UTF-16BE" , "-t" , "ASCII" ] ,
968+ input. clone ( ) ,
969+ expected_output. clone ( ) ,
970+ Vec :: new ( ) ,
971+ ) ;
972+
973+ iconv_test (
974+ & [ "-c" , "-f" , "UTF-16BE" , "-t" , "ASCII" , "-" ] ,
975+ input,
976+ expected_output,
977+ Vec :: new ( ) ,
978+ ) ;
979+ }
980+
981+ #[ test]
982+ fn iconv_UTF16BE_to_UTF32BE_conversion_without_c_flag ( ) {
983+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
984+
985+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf16be" ) ;
986+ let mut input: Vec < u8 > = Vec :: new ( ) ;
987+ File :: open ( & input_file)
988+ . unwrap ( )
989+ . read_to_end ( & mut input)
990+ . unwrap ( ) ;
991+
992+ let expected_output_file =
993+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf16be_to_utf32be_without_c_flag" ) ;
994+
995+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
996+ File :: open ( & expected_output_file)
997+ . unwrap ( )
998+ . read_to_end ( & mut expected_output)
999+ . unwrap ( ) ;
1000+
1001+ iconv_test (
1002+ & [ "-f" , "UTF-16BE" , "-t" , "UTF-32BE" ] ,
1003+ input. clone ( ) ,
1004+ expected_output. clone ( ) ,
1005+ Vec :: new ( ) ,
1006+ ) ;
1007+
1008+ iconv_test (
1009+ & [ "-f" , "UTF-16BE" , "-t" , "UTF-32BE" , "-" ] ,
1010+ input,
1011+ expected_output,
1012+ Vec :: new ( ) ,
1013+ ) ;
1014+ }
1015+
1016+ #[ test]
1017+ fn iconv_UTF16BE_to_UTF32LE_conversion_without_c_flag ( ) {
1018+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
1019+
1020+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf16be" ) ;
1021+ let mut input: Vec < u8 > = Vec :: new ( ) ;
1022+ File :: open ( & input_file)
1023+ . unwrap ( )
1024+ . read_to_end ( & mut input)
1025+ . unwrap ( ) ;
1026+
1027+ let expected_output_file =
1028+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf16be_to_utf32le_without_c_flag" ) ;
1029+
1030+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
1031+ File :: open ( & expected_output_file)
1032+ . unwrap ( )
1033+ . read_to_end ( & mut expected_output)
1034+ . unwrap ( ) ;
1035+
1036+ iconv_test (
1037+ & [ "-f" , "UTF-16BE" , "-t" , "UTF-32LE" ] ,
1038+ input. clone ( ) ,
1039+ expected_output. clone ( ) ,
1040+ Vec :: new ( ) ,
1041+ ) ;
1042+
1043+ iconv_test (
1044+ & [ "-f" , "UTF-16BE" , "-t" , "UTF-32LE" , "-" ] ,
1045+ input,
1046+ expected_output,
1047+ Vec :: new ( ) ,
1048+ ) ;
1049+ }
1050+
1051+ #[ test]
1052+ fn iconv_UTF16BE_to_UTF8_conversion_without_c_flag ( ) {
1053+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
1054+
1055+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf16be" ) ;
1056+ let mut input: Vec < u8 > = Vec :: new ( ) ;
1057+ File :: open ( & input_file)
1058+ . unwrap ( )
1059+ . read_to_end ( & mut input)
1060+ . unwrap ( ) ;
1061+
1062+ let expected_output_file =
1063+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf16be_to_utf8_without_c_flag" ) ;
1064+
1065+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
1066+ File :: open ( & expected_output_file)
1067+ . unwrap ( )
1068+ . read_to_end ( & mut expected_output)
1069+ . unwrap ( ) ;
1070+
1071+ iconv_test (
1072+ & [ "-f" , "UTF-16BE" , "-t" , "UTF-8" ] ,
1073+ input. clone ( ) ,
1074+ expected_output. clone ( ) ,
1075+ Vec :: new ( ) ,
1076+ ) ;
1077+
1078+ iconv_test (
1079+ & [ "-f" , "UTF-16BE" , "-t" , "UTF-8" , "-" ] ,
1080+ input,
1081+ expected_output,
1082+ Vec :: new ( ) ,
1083+ ) ;
1084+ }
0 commit comments