@@ -382,3 +382,178 @@ fn iconv_ASCII_to_UTF32BE_conversion_without_c_flag() {
382382 Vec :: new ( ) ,
383383 ) ;
384384}
385+
386+ #[ test]
387+ fn iconv_UTF32LE_to_UTF32BE_conversion_without_c_flag ( ) {
388+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
389+
390+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf32le" ) ;
391+ let mut input: Vec < u8 > = Vec :: new ( ) ;
392+ File :: open ( & input_file)
393+ . unwrap ( )
394+ . read_to_end ( & mut input)
395+ . unwrap ( ) ;
396+
397+ let expected_output_file =
398+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf32le_to_utf32be_without_c_flag" ) ;
399+
400+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
401+ File :: open ( & expected_output_file)
402+ . unwrap ( )
403+ . read_to_end ( & mut expected_output)
404+ . unwrap ( ) ;
405+
406+ iconv_test (
407+ & [ "-f" , "UTF-32LE" , "-t" , "UTF-32BE" ] ,
408+ input. clone ( ) ,
409+ expected_output. clone ( ) ,
410+ Vec :: new ( ) ,
411+ ) ;
412+
413+ iconv_test (
414+ & [ "-f" , "UTF-32LE" , "-t" , "UTF-32BE" , "-" ] ,
415+ input,
416+ expected_output,
417+ Vec :: new ( ) ,
418+ ) ;
419+ }
420+
421+ #[ test]
422+ fn iconv_UTF32LE_to_ASCII_conversion_with_c_flag ( ) {
423+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
424+
425+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf32le" ) ;
426+ let mut input: Vec < u8 > = Vec :: new ( ) ;
427+ File :: open ( & input_file)
428+ . unwrap ( )
429+ . read_to_end ( & mut input)
430+ . unwrap ( ) ;
431+
432+ let expected_output_file =
433+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf32le_to_ascii_with_c_flag" ) ;
434+
435+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
436+ File :: open ( & expected_output_file)
437+ . unwrap ( )
438+ . read_to_end ( & mut expected_output)
439+ . unwrap ( ) ;
440+
441+ iconv_test (
442+ & [ "-c" , "-f" , "UTF-32LE" , "-t" , "ASCII" ] ,
443+ input. clone ( ) ,
444+ expected_output. clone ( ) ,
445+ Vec :: new ( ) ,
446+ ) ;
447+
448+ iconv_test (
449+ & [ "-c" , "-f" , "UTF-32LE" , "-t" , "ASCII" , "-" ] ,
450+ input,
451+ expected_output,
452+ Vec :: new ( ) ,
453+ ) ;
454+ }
455+
456+ #[ test]
457+ fn iconv_UTF32LE_to_UTF8_conversion_without_c_flag ( ) {
458+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
459+
460+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf32le" ) ;
461+ let mut input: Vec < u8 > = Vec :: new ( ) ;
462+ File :: open ( & input_file)
463+ . unwrap ( )
464+ . read_to_end ( & mut input)
465+ . unwrap ( ) ;
466+
467+ let expected_output_file =
468+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf32le_to_utf8_without_c_flag" ) ;
469+
470+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
471+ File :: open ( & expected_output_file)
472+ . unwrap ( )
473+ . read_to_end ( & mut expected_output)
474+ . unwrap ( ) ;
475+
476+ iconv_test (
477+ & [ "-f" , "UTF-32LE" , "-t" , "UTF-8" ] ,
478+ input. clone ( ) ,
479+ expected_output. clone ( ) ,
480+ Vec :: new ( ) ,
481+ ) ;
482+
483+ iconv_test (
484+ & [ "-f" , "UTF-32LE" , "-t" , "UTF-8" , "-" ] ,
485+ input,
486+ expected_output,
487+ Vec :: new ( ) ,
488+ ) ;
489+ }
490+
491+ #[ test]
492+ fn iconv_UTF32LE_to_UTF16LE_conversion_without_c_flag ( ) {
493+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
494+
495+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf32le" ) ;
496+ let mut input: Vec < u8 > = Vec :: new ( ) ;
497+ File :: open ( & input_file)
498+ . unwrap ( )
499+ . read_to_end ( & mut input)
500+ . unwrap ( ) ;
501+
502+ let expected_output_file =
503+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf32le_to_utf16le_without_c_flag" ) ;
504+
505+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
506+ File :: open ( & expected_output_file)
507+ . unwrap ( )
508+ . read_to_end ( & mut expected_output)
509+ . unwrap ( ) ;
510+
511+ iconv_test (
512+ & [ "-f" , "UTF-32LE" , "-t" , "UTF-16LE" ] ,
513+ input. clone ( ) ,
514+ expected_output. clone ( ) ,
515+ Vec :: new ( ) ,
516+ ) ;
517+
518+ iconv_test (
519+ & [ "-f" , "UTF-32LE" , "-t" , "UTF-16LE" , "-" ] ,
520+ input,
521+ expected_output,
522+ Vec :: new ( ) ,
523+ ) ;
524+ }
525+
526+ #[ test]
527+ fn iconv_UTF32LE_to_UTF16BE_conversion_without_c_flag ( ) {
528+ let cargo_manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) ;
529+
530+ let input_file = cargo_manifest_dir. join ( "tests/iconv/test_data_utf32le" ) ;
531+ let mut input: Vec < u8 > = Vec :: new ( ) ;
532+ File :: open ( & input_file)
533+ . unwrap ( )
534+ . read_to_end ( & mut input)
535+ . unwrap ( ) ;
536+
537+ let expected_output_file =
538+ cargo_manifest_dir. join ( "tests/iconv/test_data_utf32le_to_utf16be_without_c_flag" ) ;
539+
540+ let mut expected_output: Vec < u8 > = Vec :: new ( ) ;
541+ File :: open ( & expected_output_file)
542+ . unwrap ( )
543+ . read_to_end ( & mut expected_output)
544+ . unwrap ( ) ;
545+
546+ iconv_test (
547+ & [ "-f" , "UTF-32LE" , "-t" , "UTF-16BE" ] ,
548+ input. clone ( ) ,
549+ expected_output. clone ( ) ,
550+ Vec :: new ( ) ,
551+ ) ;
552+
553+ iconv_test (
554+ & [ "-f" , "UTF-32LE" , "-t" , "UTF-16BE" , "-" ] ,
555+ input,
556+ expected_output,
557+ Vec :: new ( ) ,
558+ ) ;
559+ }
0 commit comments