├── .gitignore ├── .travis.yml ├── Makefile ├── README.md ├── author ├── includes ├── ft_printf.h └── libft.h ├── libft ├── Makefile ├── ft_atoi.c ├── ft_bigint_add.c ├── ft_bigint_divide_by_two.c ├── ft_bigint_get_index.c ├── ft_bigint_multiply_by_two.c ├── ft_bigint_round.c ├── ft_bigint_shift_right.c ├── ft_bigint_trim.c ├── ft_bzero.c ├── ft_convert_base.c ├── ft_isalnum.c ├── ft_isalpha.c ├── ft_isascii.c ├── ft_isdigit.c ├── ft_isprint.c ├── ft_itoa.c ├── ft_memalloc.c ├── ft_memccpy.c ├── ft_memchr.c ├── ft_memcmp.c ├── ft_memcpy.c ├── ft_memdel.c ├── ft_memmove.c ├── ft_memset.c ├── ft_putchar.c ├── ft_putchar_fd.c ├── ft_putendl.c ├── ft_putendl_fd.c ├── ft_putnbr.c ├── ft_putnbr_fd.c ├── ft_putstr.c ├── ft_putstr_fd.c ├── ft_str_insert.c ├── ft_str_left_shift.c ├── ft_str_right_shift.c ├── ft_strcat.c ├── ft_strcat_r.c ├── ft_strchr.c ├── ft_strclr.c ├── ft_strcmp.c ├── ft_strcpy.c ├── ft_strdel.c ├── ft_strdup.c ├── ft_strequ.c ├── ft_striter.c ├── ft_striteri.c ├── ft_strjoin.c ├── ft_strlcat.c ├── ft_strlen.c ├── ft_strmap.c ├── ft_strmapi.c ├── ft_strncat.c ├── ft_strncmp.c ├── ft_strncpy.c ├── ft_strnequ.c ├── ft_strnew.c ├── ft_strnstr.c ├── ft_strrchr.c ├── ft_strsplit.c ├── ft_strstr.c ├── ft_strsub.c ├── ft_strtrim.c ├── ft_tolower.c ├── ft_toupper.c ├── ft_ulltoa.c ├── ft_wcslen.c └── libft.h ├── main.c ├── srcs ├── ft_dprintf.c ├── ft_print_arg │ ├── ft_print_c.c │ ├── ft_print_d.c │ ├── ft_print_d_h.c │ ├── ft_print_d_hh.c │ ├── ft_print_d_l.c │ ├── ft_print_d_ll.c │ ├── ft_print_e.c │ ├── ft_print_e_l.c │ ├── ft_print_e_l_maj.c │ ├── ft_print_f.c │ ├── ft_print_f_l.c │ ├── ft_print_f_l_maj.c │ ├── ft_print_nb.c │ ├── ft_print_nb_h.c │ ├── ft_print_nb_hh.c │ ├── ft_print_nb_l.c │ ├── ft_print_nb_ll.c │ ├── ft_print_p.c │ ├── ft_print_percent.c │ ├── ft_print_s.c │ └── ft_printf_arg.c ├── ft_printf.c ├── ft_sprintf.c ├── helpers │ ├── ft_add_char.c │ ├── ft_apply_e.c │ ├── ft_condition_fill.c │ ├── ft_condition_flag.c │ ├── ft_convert_output.c │ ├── ft_flaglen.c │ ├── ft_format_is_valid.c │ ├── ft_get_binary.c │ ├── ft_get_color.c │ ├── ft_itoa_e.c │ ├── ft_itoa_f.c │ ├── ft_itoa_f_l.c │ ├── ft_nblen_ull.c │ ├── ft_print_null.c │ ├── ft_size_to_allocate.c │ ├── ft_str_join.c │ ├── ft_str_join_r.c │ ├── ft_str_precision_count.c │ ├── ft_strcat_char.c │ ├── ft_strdup_alloc.c │ └── ft_ulltoa_offset.c ├── padding │ ├── ft_apply_padding_e.c │ ├── ft_apply_padding_nb.c │ ├── ft_apply_padding_p.c │ └── ft_apply_padding_str.c ├── parser │ ├── ft_create_flag.c │ ├── ft_flag_create_space.c │ ├── ft_flag_get_hash.c │ ├── ft_flag_get_key.c │ ├── ft_flag_get_length.c │ ├── ft_flag_get_minus.c │ ├── ft_flag_get_plus.c │ ├── ft_flag_get_precision.c │ ├── ft_flag_get_width.c │ └── ft_flag_get_zero.c └── precision │ ├── ft_apply_precision_nb.c │ └── ft_apply_precision_str.c └── tests ├── .gitignore ├── README.md ├── auteur ├── framework ├── Makefile ├── includes │ ├── frmk_error.h │ ├── frmk_libunit.h │ ├── frmk_print.h │ ├── frmk_stdout_utils.h │ └── frmk_utils.h └── srcs │ ├── frmk_launch_tests.c │ ├── frmk_load_test.c │ ├── frmk_print.c │ ├── frmk_print_trace.c │ ├── frmk_stdout_utils.c │ └── frmk_utils.c ├── images ├── makefile_libftprintf_path.png ├── printf_unit_test.png └── trace.png ├── templates ├── 000_launcher_template.c ├── XXX_test_template.c ├── header_template.h └── main_template.h └── tests ├── Makefile ├── conv_c ├── 000_launcher.c ├── 001_char_null.c ├── 002_ascii_chars.c ├── 003_ascii_chars_8_width.c ├── 004_ascii_chars_8_width_flag.c ├── 005_short_max.c └── conv_c.h ├── conv_cap_x ├── 000_launcher.c ├── 001_zero_and_various_flags.c ├── 002_zero_and_various_flags_and_1_width.c ├── 003_zero_and_various_flags_and_23_width.c ├── 004_zero_and_various_flags_and_dot_precision.c ├── 005_zero_and_various_flags_and_5_precision.c ├── 006_zero_and_various_flags_and_1_width_and_dot_precision.c ├── 007_zero_and_various_flags_and_23_width_and_dot_precision.c ├── 008_zero_and_various_flags_and_1_width_and_5_precision.c ├── 009_zero_and_various_flags_and_23_width_and_5_precision.c ├── 010_zero_and_various_flags_combined.c ├── 011_zero_and_various_flags_combined_and_1_width.c ├── 012_zero_and_various_flags_combined_and_23_width.c ├── 013_zero_and_various_flags_combined_and_dot_precision.c ├── 014_zero_and_various_flags_combined_and_5_precision.c ├── 015_zero_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 016_zero_and_various_flags_combined_and_1_width_and_5_precision.c ├── 017_zero_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 018_zero_and_various_flags_combined_and_23_width_and_5_precision.c ├── 019_uint_max_and_various_flags.c ├── 020_uint_max_and_various_flags_and_1_width.c ├── 021_uint_max_and_various_flags_and_23_width.c ├── 022_uint_max_and_various_flags_and_dot_precision.c ├── 023_uint_max_and_various_flags_and_5_precision.c ├── 024_uint_max_and_various_flags_and_1_width_and_dot_precision.c ├── 025_uint_max_and_various_flags_and_23_width_and_dot_precision.c ├── 026_uint_max_and_various_flags_and_1_width_and_5_precision.c ├── 027_uint_max_and_various_flags_and_23_width_and_5_precision.c ├── 028_uint_max_and_various_flags_combined.c ├── 029_uint_max_and_various_flags_combined_and_1_width.c ├── 030_uint_max_and_various_flags_combined_and_23_width.c ├── 031_uint_max_and_various_flags_combined_and_dot_precision.c ├── 032_uint_max_and_various_flags_combined_and_5_precision.c ├── 033_uint_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 034_uint_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 035_uint_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 036_uint_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 037_ulong_max_and_various_flags.c ├── 038_ulong_max_and_various_flags_and_1_width.c ├── 039_ulong_max_and_various_flags_and_23_width.c ├── 040_ulong_max_and_various_flags_and_dot_precision.c ├── 041_ulong_max_and_various_flags_and_5_precision.c ├── 042_ulong_max_and_various_flags_and_1_width_and_dot_precision.c ├── 043_ulong_max_and_various_flags_and_23_width_and_dot_precision.c ├── 044_ulong_max_and_various_flags_and_1_width_and_5_precision.c ├── 045_ulong_max_and_various_flags_and_23_width_and_5_precision.c ├── 046_ulong_max_and_various_flags_combined.c ├── 047_ulong_max_and_various_flags_combined_and_1_width.c ├── 048_ulong_max_and_various_flags_combined_and_23_width.c ├── 049_ulong_max_and_various_flags_combined_and_dot_precision.c ├── 050_ulong_max_and_various_flags_combined_and_5_precision.c ├── 051_ulong_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 052_ulong_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 053_ulong_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 054_ulong_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 055_ullong_max_and_various_flags.c ├── 056_ullong_max_and_various_flags_and_1_width.c ├── 057_ullong_max_and_various_flags_and_23_width.c ├── 058_ullong_max_and_various_flags_and_dot_precision.c ├── 059_ullong_max_and_various_flags_and_5_precision.c ├── 060_ullong_max_and_various_flags_and_1_width_and_dot_precision.c ├── 061_ullong_max_and_various_flags_and_23_width_and_dot_precision.c ├── 062_ullong_max_and_various_flags_and_1_width_and_5_precision.c ├── 063_ullong_max_and_various_flags_and_23_width_and_5_precision.c ├── 064_ullong_max_and_various_flags_combined.c ├── 065_ullong_max_and_various_flags_combined_and_1_width.c ├── 066_ullong_max_and_various_flags_combined_and_23_width.c ├── 067_ullong_max_and_various_flags_combined_and_dot_precision.c ├── 068_ullong_max_and_various_flags_combined_and_5_precision.c ├── 069_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 070_ullong_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 071_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 072_ullong_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 073_ullong_max_and_various_flags_hh_modifier.c ├── 074_ullong_max_and_various_flags_and_1_width_hh_modifier.c ├── 075_ullong_max_and_various_flags_and_23_width_hh_modifier.c ├── 076_ullong_max_and_various_flags_and_dot_precision_hh_modifier.c ├── 077_ullong_max_and_various_flags_and_5_precision_hh_modifier.c ├── 078_ullong_max_and_various_flags_and_1_width_and_dot_precision_hh_modifier.c ├── 079_ullong_max_and_various_flags_and_23_width_and_dot_precision_hh_modifier.c ├── 080_ullong_max_and_various_flags_and_1_width_and_5_precision_hh_modifier.c ├── 081_ullong_max_and_various_flags_and_23_width_and_5_precision_hh_modifier.c ├── 082_ullong_max_and_various_flags_combined_hh_modifier.c ├── 083_ullong_max_and_various_flags_combined_and_1_width_hh_modifier.c ├── 084_ullong_max_and_various_flags_combined_and_23_width_hh_modifier.c ├── 085_ullong_max_and_various_flags_combined_and_dot_precision_hh_modifier.c ├── 086_ullong_max_and_various_flags_combined_and_5_precision_hh_modifier.c ├── 087_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_hh_modifier.c ├── 088_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_hh_modifier.c ├── 089_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_hh_modifier.c ├── 090_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_hh_modifier.c ├── 091_ullong_max_and_various_flags_h_modifier.c ├── 092_ullong_max_and_various_flags_and_1_width_h_modifier.c ├── 093_ullong_max_and_various_flags_and_23_width_h_modifier.c ├── 094_ullong_max_and_various_flags_and_dot_precision_h_modifier.c ├── 095_ullong_max_and_various_flags_and_5_precision_h_modifier.c ├── 096_ullong_max_and_various_flags_and_1_width_and_dot_precision_h_modifier.c ├── 097_ullong_max_and_various_flags_and_23_width_and_dot_precision_h_modifier.c ├── 098_ullong_max_and_various_flags_and_1_width_and_5_precision_h_modifier.c ├── 099_ullong_max_and_various_flags_and_23_width_and_5_precision_h_modifier.c ├── 100_ullong_max_and_various_flags_combined_h_modifier.c ├── 101_ullong_max_and_various_flags_combined_and_1_width_h_modifier.c ├── 102_ullong_max_and_various_flags_combined_and_23_width_h_modifier.c ├── 103_ullong_max_and_various_flags_combined_and_dot_precision_h_modifier.c ├── 104_ullong_max_and_various_flags_combined_and_5_precision_h_modifier.c ├── 105_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_h_modifier.c ├── 106_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_h_modifier.c ├── 107_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_h_modifier.c ├── 108_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_h_modifier.c ├── 109_ullong_max_and_various_flags_l_modifier.c ├── 110_ullong_max_and_various_flags_and_1_width_l_modifier.c ├── 111_ullong_max_and_various_flags_and_23_width_l_modifier.c ├── 112_ullong_max_and_various_flags_and_dot_precision_l_modifier.c ├── 113_ullong_max_and_various_flags_and_5_precision_l_modifier.c ├── 114_ullong_max_and_various_flags_and_1_width_and_dot_precision_l_modifier.c ├── 115_ullong_max_and_various_flags_and_23_width_and_dot_precision_l_modifier.c ├── 116_ullong_max_and_various_flags_and_1_width_and_5_precision_l_modifier.c ├── 117_ullong_max_and_various_flags_and_23_width_and_5_precision_l_modifier.c ├── 118_ullong_max_and_various_flags_combined_l_modifier.c ├── 119_ullong_max_and_various_flags_combined_and_1_width_l_modifier.c ├── 120_ullong_max_and_various_flags_combined_and_23_width_l_modifier.c ├── 121_ullong_max_and_various_flags_combined_and_dot_precision_l_modifier.c ├── 122_ullong_max_and_various_flags_combined_and_5_precision_l_modifier.c ├── 123_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_l_modifier.c ├── 124_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_l_modifier.c ├── 125_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_l_modifier.c ├── 126_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_l_modifier.c ├── 127_ullong_max_and_various_flags_ll_modifier.c ├── 128_ullong_max_and_various_flags_and_1_width_ll_modifier.c ├── 129_ullong_max_and_various_flags_and_23_width_ll_modifier.c ├── 130_ullong_max_and_various_flags_and_dot_precision_ll_modifier.c ├── 131_ullong_max_and_various_flags_and_5_precision_ll_modifier.c ├── 132_ullong_max_and_various_flags_and_1_width_and_dot_precision_ll_modifier.c ├── 133_ullong_max_and_various_flags_and_23_width_and_dot_precision_ll_modifier.c ├── 134_ullong_max_and_various_flags_and_1_width_and_5_precision_ll_modifier.c ├── 135_ullong_max_and_various_flags_and_23_width_and_5_precision_ll_modifier.c ├── 136_ullong_max_and_various_flags_combined_ll_modifier.c ├── 137_ullong_max_and_various_flags_combined_and_1_width_ll_modifier.c ├── 138_ullong_max_and_various_flags_combined_and_23_width_ll_modifier.c ├── 139_ullong_max_and_various_flags_combined_and_dot_precision_ll_modifier.c ├── 140_ullong_max_and_various_flags_combined_and_5_precision_ll_modifier.c ├── 141_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_ll_modifier.c ├── 142_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_ll_modifier.c ├── 143_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_ll_modifier.c ├── 144_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_ll_modifier.c └── conv_cap_x.h ├── conv_d ├── 000_launcher.c ├── 001_zero_and_various_flags.c ├── 002_zero_and_various_flags_and_1_width.c ├── 003_zero_and_various_flags_and_23_width.c ├── 004_zero_and_various_flags_and_dot_precision.c ├── 005_zero_and_various_flags_and_5_precision.c ├── 006_zero_and_various_flags_and_1_width_and_dot_precision.c ├── 007_zero_and_various_flags_and_23_width_and_dot_precision.c ├── 008_zero_and_various_flags_and_1_width_and_5_precision.c ├── 009_zero_and_various_flags_and_23_width_and_5_precision.c ├── 010_zero_and_various_flags_combined.c ├── 011_zero_and_various_flags_combined_and_1_width.c ├── 012_zero_and_various_flags_combined_and_23_width.c ├── 013_zero_and_various_flags_combined_and_dot_precision.c ├── 014_zero_and_various_flags_combined_and_5_precision.c ├── 015_zero_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 016_zero_and_various_flags_combined_and_1_width_and_5_precision.c ├── 017_zero_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 018_zero_and_various_flags_combined_and_23_width_and_5_precision.c ├── 019_minus_zero_and_various_flags.c ├── 020_minus_zero_and_various_flags_and_1_width.c ├── 021_minus_zero_and_various_flags_and_23_width.c ├── 022_minus_zero_and_various_flags_and_dot_precision.c ├── 023_minus_zero_and_various_flags_and_5_precision.c ├── 024_minus_zero_and_various_flags_and_1_width_and_dot_precision.c ├── 025_minus_zero_and_various_flags_and_23_width_and_dot_precision.c ├── 026_minus_zero_and_various_flags_and_1_width_and_5_precision.c ├── 027_minus_zero_and_various_flags_and_23_width_and_5_precision.c ├── 028_minus_zero_and_various_flags_combined.c ├── 029_minus_zero_and_various_flags_combined_and_1_width.c ├── 030_minus_zero_and_various_flags_combined_and_23_width.c ├── 031_minus_zero_and_various_flags_combined_and_dot_precision.c ├── 032_minus_zero_and_various_flags_combined_and_5_precision.c ├── 033_minus_zero_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 034_minus_zero_and_various_flags_combined_and_1_width_and_5_precision.c ├── 035_minus_zero_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 036_minus_zero_and_various_flags_combined_and_23_width_and_5_precision.c ├── 037_int_max_and_various_flags.c ├── 038_int_max_and_various_flags_and_1_width.c ├── 039_int_max_and_various_flags_and_23_width.c ├── 040_int_max_and_various_flags_and_dot_precision.c ├── 041_int_max_and_various_flags_and_5_precision.c ├── 042_int_max_and_various_flags_and_1_width_and_dot_precision.c ├── 043_int_max_and_various_flags_and_23_width_and_dot_precision.c ├── 044_int_max_and_various_flags_and_1_width_and_5_precision.c ├── 045_int_max_and_various_flags_and_23_width_and_5_precision.c ├── 046_int_max_and_various_flags_combined.c ├── 047_int_max_and_various_flags_combined_and_1_width.c ├── 048_int_max_and_various_flags_combined_and_23_width.c ├── 049_int_max_and_various_flags_combined_and_dot_precision.c ├── 050_int_max_and_various_flags_combined_and_5_precision.c ├── 051_int_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 052_int_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 053_int_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 054_int_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 055_int_min_and_various_flags.c ├── 056_int_min_and_various_flags_and_1_width.c ├── 057_int_min_and_various_flags_and_23_width.c ├── 058_int_min_and_various_flags_and_dot_precision.c ├── 059_int_min_and_various_flags_and_5_precision.c ├── 060_int_min_and_various_flags_and_1_width_and_dot_precision.c ├── 061_int_min_and_various_flags_and_23_width_and_dot_precision.c ├── 062_int_min_and_various_flags_and_1_width_and_5_precision.c ├── 063_int_min_and_various_flags_and_23_width_and_5_precision.c ├── 064_int_min_and_various_flags_combined.c ├── 065_int_min_and_various_flags_combined_and_1_width.c ├── 066_int_min_and_various_flags_combined_and_23_width.c ├── 067_int_min_and_various_flags_combined_and_dot_precision.c ├── 068_int_min_and_various_flags_combined_and_5_precision.c ├── 069_int_min_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 070_int_min_and_various_flags_combined_and_1_width_and_5_precision.c ├── 071_int_min_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 072_int_min_and_various_flags_combined_and_23_width_and_5_precision.c ├── 073_uint_max_and_various_flags.c ├── 074_uint_max_and_various_flags_and_1_width.c ├── 075_uint_max_and_various_flags_and_23_width.c ├── 076_uint_max_and_various_flags_and_dot_precision.c ├── 077_uint_max_and_various_flags_and_5_precision.c ├── 078_uint_max_and_various_flags_and_1_width_and_dot_precision.c ├── 079_uint_max_and_various_flags_and_23_width_and_dot_precision.c ├── 080_uint_max_and_various_flags_and_1_width_and_5_precision.c ├── 081_uint_max_and_various_flags_and_23_width_and_5_precision.c ├── 082_uint_max_and_various_flags_combined.c ├── 083_uint_max_and_various_flags_combined_and_1_width.c ├── 084_uint_max_and_various_flags_combined_and_23_width.c ├── 085_uint_max_and_various_flags_combined_and_dot_precision.c ├── 086_uint_max_and_various_flags_combined_and_5_precision.c ├── 087_uint_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 088_uint_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 089_uint_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 090_uint_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 091_long_max_and_various_flags.c ├── 092_long_max_and_various_flags_and_1_width.c ├── 093_long_max_and_various_flags_and_23_width.c ├── 094_long_max_and_various_flags_and_dot_precision.c ├── 095_long_max_and_various_flags_and_5_precision.c ├── 096_long_max_and_various_flags_and_1_width_and_dot_precision.c ├── 097_long_max_and_various_flags_and_23_width_and_dot_precision.c ├── 098_long_max_and_various_flags_and_1_width_and_5_precision.c ├── 099_long_max_and_various_flags_and_23_width_and_5_precision.c ├── 100_long_max_and_various_flags_combined.c ├── 101_long_max_and_various_flags_combined_and_1_width.c ├── 102_long_max_and_various_flags_combined_and_23_width.c ├── 103_long_max_and_various_flags_combined_and_dot_precision.c ├── 104_long_max_and_various_flags_combined_and_5_precision.c ├── 105_long_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 106_long_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 107_long_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 108_long_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 109_long_min_and_various_flags.c ├── 110_long_min_and_various_flags_and_1_width.c ├── 111_long_min_and_various_flags_and_23_width.c ├── 112_long_min_and_various_flags_and_dot_precision.c ├── 113_long_min_and_various_flags_and_5_precision.c ├── 114_long_min_and_various_flags_and_1_width_and_dot_precision.c ├── 115_long_min_and_various_flags_and_23_width_and_dot_precision.c ├── 116_long_min_and_various_flags_and_1_width_and_5_precision.c ├── 117_long_min_and_various_flags_and_23_width_and_5_precision.c ├── 118_long_min_and_various_flags_combined.c ├── 119_long_min_and_various_flags_combined_and_1_width.c ├── 120_long_min_and_various_flags_combined_and_23_width.c ├── 121_long_min_and_various_flags_combined_and_dot_precision.c ├── 122_long_min_and_various_flags_combined_and_5_precision.c ├── 123_long_min_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 124_long_min_and_various_flags_combined_and_1_width_and_5_precision.c ├── 125_long_min_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 126_long_min_and_various_flags_combined_and_23_width_and_5_precision.c ├── 127_long_long_max_and_various_flags.c ├── 128_long_long_max_and_various_flags_and_1_width.c ├── 129_long_long_max_and_various_flags_and_23_width.c ├── 130_long_long_max_and_various_flags_and_dot_precision.c ├── 131_long_long_max_and_various_flags_and_5_precision.c ├── 132_long_long_max_and_various_flags_and_1_width_and_dot_precision.c ├── 133_long_long_max_and_various_flags_and_23_width_and_dot_precision.c ├── 134_long_long_max_and_various_flags_and_1_width_and_5_precision.c ├── 135_long_long_max_and_various_flags_and_23_width_and_5_precision.c ├── 136_long_long_max_and_various_flags_combined.c ├── 137_long_long_max_and_various_flags_combined_and_1_width.c ├── 138_long_long_max_and_various_flags_combined_and_23_width.c ├── 139_long_long_max_and_various_flags_combined_and_dot_precision.c ├── 140_long_long_max_and_various_flags_combined_and_5_precision.c ├── 141_long_long_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 142_long_long_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 143_long_long_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 144_long_long_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 145_long_long_max_and_various_flags_and_hh_modifier.c ├── 146_long_long_max_and_various_flags_and_1_width_and_hh_modifier.c ├── 147_long_long_max_and_various_flags_and_23_width_and_hh_modifier.c ├── 148_long_long_max_and_various_flags_and_dot_precision_and_hh_modifier.c ├── 149_long_long_max_and_various_flags_and_5_precision_and_hh_modifier.c ├── 150_long_long_max_and_various_flags_and_1_width_and_dot_precision_and_hh_modifier.c ├── 151_long_long_max_and_various_flags_and_23_width_and_dot_precision_and_hh_modifier.c ├── 152_long_long_max_and_various_flags_and_1_width_and_5_precision_and_hh_modifier.c ├── 153_long_long_max_and_various_flags_and_23_width_and_5_precision_and_hh_modifier.c ├── 154_long_long_max_and_various_flags_combined_and_hh_modifier.c ├── 155_long_long_max_and_various_flags_combined_and_1_width_and_hh_modifier.c ├── 156_long_long_max_and_various_flags_combined_and_23_width_and_hh_modifier.c ├── 157_long_long_max_and_various_flags_combined_and_dot_precision_and_hh_modifier.c ├── 158_long_long_max_and_various_flags_combined_and_5_precision_and_hh_modifier.c ├── 159_long_long_max_and_various_flags_combined_and_1_width_and_dot_precision_and_hh_modifier.c ├── 160_long_long_max_and_various_flags_combined_and_1_width_and_5_precision_and_hh_modifier.c ├── 161_long_long_max_and_various_flags_combined_and_23_width_and_dot_precision_and_hh_modifier.c ├── 162_long_long_max_and_various_flags_combined_and_23_width_and_5_precision_and_hh_modifier.c ├── 163_long_long_max_and_various_flags_and_h_modifier.c ├── 164_long_long_max_and_various_flags_and_1_width_and_h_modifier.c ├── 165_long_long_max_and_various_flags_and_23_width_and_h_modifier.c ├── 166_long_long_max_and_various_flags_and_dot_precision_and_h_modifier.c ├── 167_long_long_max_and_various_flags_and_5_precision_and_h_modifier.c ├── 168_long_long_max_and_various_flags_and_1_width_and_dot_precision_and_h_modifier.c ├── 169_long_long_max_and_various_flags_and_23_width_and_dot_precision_and_h_modifier.c ├── 170_long_long_max_and_various_flags_and_1_width_and_5_precision_and_h_modifier.c ├── 171_long_long_max_and_various_flags_and_23_width_and_5_precision_and_h_modifier.c ├── 172_long_long_max_and_various_flags_combined_and_h_modifier.c ├── 173_long_long_max_and_various_flags_combined_and_1_width_and_h_modifier.c ├── 174_long_long_max_and_various_flags_combined_and_23_width_and_h_modifier.c ├── 175_long_long_max_and_various_flags_combined_and_dot_precision_and_h_modifier.c ├── 176_long_long_max_and_various_flags_combined_and_5_precision_and_h_modifier.c ├── 177_long_long_max_and_various_flags_combined_and_1_width_and_dot_precision_and_h_modifier.c ├── 178_long_long_max_and_various_flags_combined_and_1_width_and_5_precision_and_h_modifier.c ├── 179_long_long_max_and_various_flags_combined_and_23_width_and_dot_precision_and_h_modifier.c ├── 180_long_long_max_and_various_flags_combined_and_23_width_and_5_precision_and_h_modifier.c ├── 181_long_long_max_and_various_flags_and_l_modifier.c ├── 182_long_long_max_and_various_flags_and_1_width_and_l_modifier.c ├── 183_long_long_max_and_various_flags_and_23_width_and_l_modifier.c ├── 184_long_long_max_and_various_flags_and_dot_precision_and_l_modifier.c ├── 185_long_long_max_and_various_flags_and_5_precision_and_l_modifier.c ├── 186_long_long_max_and_various_flags_and_1_width_and_dot_precision_and_l_modifier.c ├── 187_long_long_max_and_various_flags_and_23_width_and_dot_precision_and_l_modifier.c ├── 188_long_long_max_and_various_flags_and_1_width_and_5_precision_and_l_modifier.c ├── 189_long_long_max_and_various_flags_and_23_width_and_5_precision_and_l_modifier.c ├── 190_long_long_max_and_various_flags_combined_and_l_modifier.c ├── 191_long_long_max_and_various_flags_combined_and_1_width_and_l_modifier.c ├── 192_long_long_max_and_various_flags_combined_and_23_width_and_l_modifier.c ├── 193_long_long_max_and_various_flags_combined_and_dot_precision_and_l_modifier.c ├── 194_long_long_max_and_various_flags_combined_and_5_precision_and_l_modifier.c ├── 195_long_long_max_and_various_flags_combined_and_1_width_and_dot_precision_and_l_modifier.c ├── 196_long_long_max_and_various_flags_combined_and_1_width_and_5_precision_and_l_modifier.c ├── 197_long_long_max_and_various_flags_combined_and_23_width_and_dot_precision_and_l_modifier.c ├── 198_long_long_max_and_various_flags_combined_and_23_width_and_5_precision_and_l_modifier.c ├── 199_long_long_max_and_various_flags_and_ll_modifier.c ├── 200_long_long_max_and_various_flags_and_1_width_and_ll_modifier.c ├── 201_long_long_max_and_various_flags_and_23_width_and_ll_modifier.c ├── 202_long_long_max_and_various_flags_and_dot_precision_and_ll_modifier.c ├── 203_long_long_max_and_various_flags_and_5_precision_and_ll_modifier.c ├── 204_long_long_max_and_various_flags_and_1_width_and_dot_precision_and_ll_modifier.c ├── 205_long_long_max_and_various_flags_and_23_width_and_dot_precision_and_ll_modifier.c ├── 206_long_long_max_and_various_flags_and_1_width_and_5_precision_and_ll_modifier.c ├── 207_long_long_max_and_various_flags_and_23_width_and_5_precision_and_ll_modifier.c ├── 208_long_long_max_and_various_flags_combined_and_ll_modifier.c ├── 209_long_long_max_and_various_flags_combined_and_1_width_and_ll_modifier.c ├── 210_long_long_max_and_various_flags_combined_and_23_width_and_ll_modifier.c ├── 211_long_long_max_and_various_flags_combined_and_dot_precision_and_ll_modifier.c ├── 212_long_long_max_and_various_flags_combined_and_5_precision_and_ll_modifier.c ├── 213_long_long_max_and_various_flags_combined_and_1_width_and_dot_precision_and_ll_modifier.c ├── 214_long_long_max_and_various_flags_combined_and_1_width_and_5_precision_and_ll_modifier.c ├── 215_long_long_max_and_various_flags_combined_and_23_width_and_dot_precision_and_ll_modifier.c ├── 216_long_long_max_and_various_flags_combined_and_23_width_and_5_precision_and_ll_modifier.c ├── 217_long_long_min_and_various_flags.c ├── 218_long_long_min_and_various_flags_and_1_width.c ├── 219_long_long_min_and_various_flags_and_23_width.c ├── 220_long_long_min_and_various_flags_and_dot_precision.c ├── 221_long_long_min_and_various_flags_and_5_precision.c ├── 222_long_long_min_and_various_flags_and_1_width_and_dot_precision.c ├── 223_long_long_min_and_various_flags_and_23_width_and_dot_precision.c ├── 224_long_long_min_and_various_flags_and_1_width_and_5_precision.c ├── 225_long_long_min_and_various_flags_and_23_width_and_5_precision.c ├── 226_long_long_min_and_various_flags_combined.c ├── 227_long_long_min_and_various_flags_combined_and_1_width.c ├── 228_long_long_min_and_various_flags_combined_and_23_width.c ├── 229_long_long_min_and_various_flags_combined_and_dot_precision.c ├── 230_long_long_min_and_various_flags_combined_and_5_precision.c ├── 231_long_long_min_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 232_long_long_min_and_various_flags_combined_and_1_width_and_5_precision.c ├── 233_long_long_min_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 234_long_long_min_and_various_flags_combined_and_23_width_and_5_precision.c ├── 235_long_long_min_and_various_flags_and_hh_modifier.c ├── 236_long_long_min_and_various_flags_and_1_width_and_hh_modifier.c ├── 237_long_long_min_and_various_flags_and_23_width_and_hh_modifier.c ├── 238_long_long_min_and_various_flags_and_dot_precision_and_hh_modifier.c ├── 239_long_long_min_and_various_flags_and_5_precision_and_hh_modifier.c ├── 240_long_long_min_and_various_flags_and_1_width_and_dot_precision_and_hh_modifier.c ├── 241_long_long_min_and_various_flags_and_23_width_and_dot_precision_and_hh_modifier.c ├── 242_long_long_min_and_various_flags_and_1_width_and_5_precision_and_hh_modifier.c ├── 243_long_long_min_and_various_flags_and_23_width_and_5_precision_and_hh_modifier.c ├── 244_long_long_min_and_various_flags_combined_and_hh_modifier.c ├── 245_long_long_min_and_various_flags_combined_and_1_width_and_hh_modifier.c ├── 246_long_long_min_and_various_flags_combined_and_23_width_and_hh_modifier.c ├── 247_long_long_min_and_various_flags_combined_and_dot_precision_and_hh_modifier.c ├── 248_long_long_min_and_various_flags_combined_and_5_precision_and_hh_modifier.c ├── 249_long_long_min_and_various_flags_combined_and_1_width_and_dot_precision_and_hh_modifier.c ├── 250_long_long_min_and_various_flags_combined_and_1_width_and_5_precision_and_hh_modifier.c ├── 251_long_long_min_and_various_flags_combined_and_23_width_and_dot_precision_and_hh_modifier.c ├── 252_long_long_min_and_various_flags_combined_and_23_width_and_5_precision_and_hh_modifier.c ├── 253_long_long_min_and_various_flags_and_h_modifier.c ├── 254_long_long_min_and_various_flags_and_1_width_and_h_modifier.c ├── 255_long_long_min_and_various_flags_and_23_width_and_h_modifier.c ├── 256_long_long_min_and_various_flags_and_dot_precision_and_h_modifier.c ├── 257_long_long_min_and_various_flags_and_5_precision_and_h_modifier.c ├── 258_long_long_min_and_various_flags_and_1_width_and_dot_precision_and_h_modifier.c ├── 259_long_long_min_and_various_flags_and_23_width_and_dot_precision_and_h_modifier.c ├── 260_long_long_min_and_various_flags_and_1_width_and_5_precision_and_h_modifier.c ├── 261_long_long_min_and_various_flags_and_23_width_and_5_precision_and_h_modifier.c ├── 262_long_long_min_and_various_flags_combined_and_h_modifier.c ├── 263_long_long_min_and_various_flags_combined_and_1_width_and_h_modifier.c ├── 264_long_long_min_and_various_flags_combined_and_23_width_and_h_modifier.c ├── 265_long_long_min_and_various_flags_combined_and_dot_precision_and_h_modifier.c ├── 266_long_long_min_and_various_flags_combined_and_5_precision_and_h_modifier.c ├── 267_long_long_min_and_various_flags_combined_and_1_width_and_dot_precision_and_h_modifier.c ├── 268_long_long_min_and_various_flags_combined_and_1_width_and_5_precision_and_h_modifier.c ├── 269_long_long_min_and_various_flags_combined_and_23_width_and_dot_precision_and_h_modifier.c ├── 270_long_long_min_and_various_flags_combined_and_23_width_and_5_precision_and_h_modifier.c ├── 271_long_long_min_and_various_flags_and_l_modifier.c ├── 272_long_long_min_and_various_flags_and_1_width_and_l_modifier.c ├── 273_long_long_min_and_various_flags_and_23_width_and_l_modifier.c ├── 274_long_long_min_and_various_flags_and_dot_precision_and_l_modifier.c ├── 275_long_long_min_and_various_flags_and_5_precision_and_l_modifier.c ├── 276_long_long_min_and_various_flags_and_1_width_and_dot_precision_and_l_modifier.c ├── 277_long_long_min_and_various_flags_and_23_width_and_dot_precision_and_l_modifier.c ├── 278_long_long_min_and_various_flags_and_1_width_and_5_precision_and_l_modifier.c ├── 279_long_long_min_and_various_flags_and_23_width_and_5_precision_and_l_modifier.c ├── 280_long_long_min_and_various_flags_combined_and_l_modifier.c ├── 281_long_long_min_and_various_flags_combined_and_1_width_and_l_modifier.c ├── 282_long_long_min_and_various_flags_combined_and_23_width_and_l_modifier.c ├── 283_long_long_min_and_various_flags_combined_and_dot_precision_and_l_modifier.c ├── 284_long_long_min_and_various_flags_combined_and_5_precision_and_l_modifier.c ├── 285_long_long_min_and_various_flags_combined_and_1_width_and_dot_precision_and_l_modifier.c ├── 286_long_long_min_and_various_flags_combined_and_1_width_and_5_precision_and_l_modifier.c ├── 287_long_long_min_and_various_flags_combined_and_23_width_and_dot_precision_and_l_modifier.c ├── 288_long_long_min_and_various_flags_combined_and_23_width_and_5_precision_and_l_modifier.c ├── 289_long_long_min_and_various_flags_and_ll_modifier.c ├── 290_long_long_min_and_various_flags_and_1_width_and_ll_modifier.c ├── 291_long_long_min_and_various_flags_and_23_width_and_ll_modifier.c ├── 292_long_long_min_and_various_flags_and_dot_precision_and_ll_modifier.c ├── 293_long_long_min_and_various_flags_and_5_precision_and_ll_modifier.c ├── 294_long_long_min_and_various_flags_and_1_width_and_dot_precision_and_ll_modifier.c ├── 295_long_long_min_and_various_flags_and_23_width_and_dot_precision_and_ll_modifier.c ├── 296_long_long_min_and_various_flags_and_1_width_and_5_precision_and_ll_modifier.c ├── 297_long_long_min_and_various_flags_and_23_width_and_5_precision_and_ll_modifier.c ├── 298_long_long_min_and_various_flags_combined_and_ll_modifier.c ├── 299_long_long_min_and_various_flags_combined_and_1_width_and_ll_modifier.c ├── 300_long_long_min_and_various_flags_combined_and_23_width_and_ll_modifier.c ├── 301_long_long_min_and_various_flags_combined_and_dot_precision_and_ll_modifier.c ├── 302_long_long_min_and_various_flags_combined_and_5_precision_and_ll_modifier.c ├── 303_long_long_min_and_various_flags_combined_and_1_width_and_dot_precision_and_ll_modifier.c ├── 304_long_long_min_and_various_flags_combined_and_1_width_and_5_precision_and_ll_modifier.c ├── 305_long_long_min_and_various_flags_combined_and_23_width_and_dot_precision_and_ll_modifier.c ├── 306_long_long_min_and_various_flags_combined_and_23_width_and_5_precision_and_ll_modifier.c └── conv_d.h ├── conv_f ├── 000_launcher.c ├── 001_zero_double_various_flags.c ├── 002_zero_double_various_flags_and_5_width.c ├── 003_zero_double_various_flags_and_1_width.c ├── 004_zero_double_various_flags_and_dot_precision.c ├── 005_zero_double_various_flags_and_8_precision.c ├── 006_zero_double_various_flags_and_5_width_and_8_precision.c ├── 007_zero_double_various_flags_and_15_width_and_8_precision.c ├── 008_zero_double_various_flags_combined_with_minus.c ├── 009_zero_double_various_flags_combined_with_plus.c ├── 010_minus_zero_double_various_flags.c ├── 011_minus_zero_double_various_flags_and_5_width.c ├── 012_minus_zero_double_various_flags_and_1_width.c ├── 013_minus_zero_double_various_flags_and_dot_precision.c ├── 014_minus_zero_double_various_flags_and_8_precision.c ├── 015_minus_zero_double_various_flags_and_5_width_and_8_precision.c ├── 016_minus_zero_double_various_flags_and_15_width_and_8_precision.c ├── 017_minus_zero_double_various_flags_combined_with_minus.c ├── 018_minus_zero_double_various_flags_combined_with_plus.c ├── 019_nan_various_flags.c ├── 020_nan_various_flags_and_5_width.c ├── 021_nan_various_flags_and_1_width.c ├── 022_nan_various_flags_and_dot_precision.c ├── 023_nan_various_flags_and_8_precision.c ├── 024_nan_various_flags_and_5_width_and_8_precision.c ├── 025_nan_various_flags_and_15_width_and_8_precision.c ├── 026_nan_various_flags_combined_with_minus.c ├── 027_nan_various_flags_combined_with_plus.c ├── 028_infinity_various_flags.c ├── 029_infinity_various_flags_and_5_width.c ├── 030_infinity_various_flags_and_1_width.c ├── 031_infinity_various_flags_and_dot_precision.c ├── 032_infinity_various_flags_and_8_precision.c ├── 033_infinity_various_flags_and_5_width_and_8_precision.c ├── 034_infinity_various_flags_and_15_width_and_8_precision.c ├── 035_infinity_various_flags_combined_with_minus.c ├── 036_infinity_various_flags_combined_with_plus.c ├── 037_minus_infinity_various_flags.c ├── 038_minus_infinity_various_flags_and_5_width.c ├── 039_minus_infinity_various_flags_and_1_width.c ├── 040_minus_infinity_various_flags_and_dot_precision.c ├── 041_minus_infinity_various_flags_and_8_precision.c ├── 042_minus_infinity_various_flags_and_5_width_and_8_precision.c ├── 043_minus_infinity_various_flags_and_15_width_and_8_precision.c ├── 044_minus_infinity_various_flags_combined_with_minus.c ├── 045_minus_infinity_various_flags_combined_with_plus.c ├── 046_double_various_flags.c ├── 047_double_various_flags_and_5_width.c ├── 048_double_various_flags_and_1_width.c ├── 049_double_various_flags_and_dot_precision.c ├── 050_double_various_flags_and_8_precision.c ├── 051_double_various_flags_and_5_width_and_8_precision.c ├── 052_double_various_flags_and_15_width_and_8_precision.c ├── 053_double_various_flags_combined_with_minus.c ├── 054_double_various_flags_combined_with_plus.c ├── 055_double_various_flags_l_length_modifier.c ├── 056_double_various_flags_and_5_width_l_length_modifier.c ├── 057_double_various_flags_and_1_width_l_length_modifier.c ├── 058_double_various_flags_and_dot_precision_l_length_modifier.c ├── 059_double_various_flags_and_8_precision_l_length_modifier.c ├── 060_double_various_flags_and_5_width_and_8_precision_l_length_modifier.c ├── 061_double_various_flags_and_15_width_and_8_precision_l_length_modifier.c ├── 062_double_various_flags_combined_with_minus_l_length_modifier.c ├── 063_double_various_flags_combined_with_plus_l_length_modifier.c ├── 064_negative_double_various_flags.c ├── 065_negative_double_various_flags_and_5_width.c ├── 066_negative_double_various_flags_and_1_width.c ├── 067_negative_double_various_flags_and_dot_precision.c ├── 068_negative_double_various_flags_and_8_precision.c ├── 069_negative_double_various_flags_and_5_width_and_8_precision.c ├── 070_negative_double_various_flags_and_15_width_and_8_precision.c ├── 071_negative_double_various_flags_combined_with_minus.c ├── 072_negative_double_various_flags_combined_with_plus.c ├── 073_double_max_various_flags.c ├── 074_double_max_various_flags_and_5_width.c ├── 075_double_max_various_flags_and_1_width.c ├── 076_double_max_various_flags_and_dot_precision.c ├── 077_double_max_various_flags_and_8_precision.c ├── 078_double_max_various_flags_and_5_width_and_8_precision.c ├── 079_double_max_various_flags_and_15_width_and_8_precision.c ├── 080_double_max_various_flags_combined_with_minus.c ├── 081_double_max_various_flags_combined_with_plus.c ├── 082_double_min_various_flags.c ├── 083_double_min_various_flags_and_5_width.c ├── 084_double_min_various_flags_and_1_width.c ├── 085_double_min_various_flags_and_dot_precision.c ├── 086_double_min_various_flags_and_8_precision.c ├── 087_double_min_various_flags_and_5_width_and_8_precision.c ├── 088_double_min_various_flags_and_15_width_and_8_precision.c ├── 089_double_min_various_flags_combined_with_minus.c ├── 090_double_min_various_flags_combined_with_plus.c ├── 091_long_double_various_flags.c ├── 092_long_double_various_flags_and_5_width.c ├── 093_long_double_various_flags_and_1_width.c ├── 094_long_double_various_flags_and_dot_precision.c ├── 095_long_double_various_flags_and_8_precision.c ├── 096_long_double_various_flags_and_5_width_and_8_precision.c ├── 097_long_double_various_flags_and_15_width_and_8_precision.c ├── 098_long_double_various_flags_combined_with_minus.c ├── 099_long_double_various_flags_combined_with_plus.c ├── 100_long_double_max.c ├── 101_long_double_min.c ├── 102_rounding_only_nines_1.c ├── 103_rounding_only_nines_2.c ├── 104_rounding_not_only_nines.c ├── 105_rounding_not_only_nines_2.c ├── 106_rounding_normal.c ├── 107_rounding_only_nines_width_small.c ├── 108_rounding_only_nines_width_large.c ├── 109_rounding_middle_down.c ├── 110_rounding_middle_up.c ├── 111_powers_of_10.c ├── 112_negative_powers_of_10.c ├── 113_denormalized_numbers.c ├── 114_errors.c └── conv_f.h ├── conv_i ├── 000_launcher.c ├── 001_zero_and_various_flags.c ├── 002_zero_and_various_flags_and_1_width.c ├── 003_zero_and_various_flags_and_23_width.c ├── 004_zero_and_various_flags_and_dot_precision.c ├── 005_zero_and_various_flags_and_5_precision.c ├── 006_zero_and_various_flags_and_1_width_and_dot_precision.c ├── 007_zero_and_various_flags_and_23_width_and_dot_precision.c ├── 008_zero_and_various_flags_and_1_width_and_5_precision.c ├── 009_zero_and_various_flags_and_23_width_and_5_precision.c ├── 010_zero_and_various_flags_combined.c ├── 011_zero_and_various_flags_combined_and_1_width.c ├── 012_zero_and_various_flags_combined_and_23_width.c ├── 013_zero_and_various_flags_combined_and_dot_precision.c ├── 014_zero_and_various_flags_combined_and_5_precision.c ├── 015_zero_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 016_zero_and_various_flags_combined_and_1_width_and_5_precision.c ├── 017_zero_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 018_zero_and_various_flags_combined_and_23_width_and_5_precision.c ├── 019_minus_zero_and_various_flags.c ├── 020_minus_zero_and_various_flags_and_1_width.c ├── 021_minus_zero_and_various_flags_and_23_width.c ├── 022_minus_zero_and_various_flags_and_dot_precision.c ├── 023_minus_zero_and_various_flags_and_5_precision.c ├── 024_minus_zero_and_various_flags_and_1_width_and_dot_precision.c ├── 025_minus_zero_and_various_flags_and_23_width_and_dot_precision.c ├── 026_minus_zero_and_various_flags_and_1_width_and_5_precision.c ├── 027_minus_zero_and_various_flags_and_23_width_and_5_precision.c ├── 028_minus_zero_and_various_flags_combined.c ├── 029_minus_zero_and_various_flags_combined_and_1_width.c ├── 030_minus_zero_and_various_flags_combined_and_23_width.c ├── 031_minus_zero_and_various_flags_combined_and_dot_precision.c ├── 032_minus_zero_and_various_flags_combined_and_5_precision.c ├── 033_minus_zero_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 034_minus_zero_and_various_flags_combined_and_1_width_and_5_precision.c ├── 035_minus_zero_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 036_minus_zero_and_various_flags_combined_and_23_width_and_5_precision.c ├── 037_int_max_and_various_flags.c ├── 038_int_max_and_various_flags_and_1_width.c ├── 039_int_max_and_various_flags_and_23_width.c ├── 040_int_max_and_various_flags_and_dot_precision.c ├── 041_int_max_and_various_flags_and_5_precision.c ├── 042_int_max_and_various_flags_and_1_width_and_dot_precision.c ├── 043_int_max_and_various_flags_and_23_width_and_dot_precision.c ├── 044_int_max_and_various_flags_and_1_width_and_5_precision.c ├── 045_int_max_and_various_flags_and_23_width_and_5_precision.c ├── 046_int_max_and_various_flags_combined.c ├── 047_int_max_and_various_flags_combined_and_1_width.c ├── 048_int_max_and_various_flags_combined_and_23_width.c ├── 049_int_max_and_various_flags_combined_and_dot_precision.c ├── 050_int_max_and_various_flags_combined_and_5_precision.c ├── 051_int_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 052_int_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 053_int_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 054_int_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 055_int_min_and_various_flags.c ├── 056_int_min_and_various_flags_and_1_width.c ├── 057_int_min_and_various_flags_and_23_width.c ├── 058_int_min_and_various_flags_and_dot_precision.c ├── 059_int_min_and_various_flags_and_5_precision.c ├── 060_int_min_and_various_flags_and_1_width_and_dot_precision.c ├── 061_int_min_and_various_flags_and_23_width_and_dot_precision.c ├── 062_int_min_and_various_flags_and_1_width_and_5_precision.c ├── 063_int_min_and_various_flags_and_23_width_and_5_precision.c ├── 064_int_min_and_various_flags_combined.c ├── 065_int_min_and_various_flags_combined_and_1_width.c ├── 066_int_min_and_various_flags_combined_and_23_width.c ├── 067_int_min_and_various_flags_combined_and_dot_precision.c ├── 068_int_min_and_various_flags_combined_and_5_precision.c ├── 069_int_min_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 070_int_min_and_various_flags_combined_and_1_width_and_5_precision.c ├── 071_int_min_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 072_int_min_and_various_flags_combined_and_23_width_and_5_precision.c ├── 073_uint_max_and_various_flags.c ├── 074_uint_max_and_various_flags_and_1_width.c ├── 075_uint_max_and_various_flags_and_23_width.c ├── 076_uint_max_and_various_flags_and_dot_precision.c ├── 077_uint_max_and_various_flags_and_5_precision.c ├── 078_uint_max_and_various_flags_and_1_width_and_dot_precision.c ├── 079_uint_max_and_various_flags_and_23_width_and_dot_precision.c ├── 080_uint_max_and_various_flags_and_1_width_and_5_precision.c ├── 081_uint_max_and_various_flags_and_23_width_and_5_precision.c ├── 082_uint_max_and_various_flags_combined.c ├── 083_uint_max_and_various_flags_combined_and_1_width.c ├── 084_uint_max_and_various_flags_combined_and_23_width.c ├── 085_uint_max_and_various_flags_combined_and_dot_precision.c ├── 086_uint_max_and_various_flags_combined_and_5_precision.c ├── 087_uint_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 088_uint_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 089_uint_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 090_uint_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 091_long_max_and_various_flags.c ├── 092_long_max_and_various_flags_and_1_width.c ├── 093_long_max_and_various_flags_and_23_width.c ├── 094_long_max_and_various_flags_and_dot_precision.c ├── 095_long_max_and_various_flags_and_5_precision.c ├── 096_long_max_and_various_flags_and_1_width_and_dot_precision.c ├── 097_long_max_and_various_flags_and_23_width_and_dot_precision.c ├── 098_long_max_and_various_flags_and_1_width_and_5_precision.c ├── 099_long_max_and_various_flags_and_23_width_and_5_precision.c ├── 100_long_max_and_various_flags_combined.c ├── 101_long_max_and_various_flags_combined_and_1_width.c ├── 102_long_max_and_various_flags_combined_and_23_width.c ├── 103_long_max_and_various_flags_combined_and_dot_precision.c ├── 104_long_max_and_various_flags_combined_and_5_precision.c ├── 105_long_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 106_long_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 107_long_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 108_long_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 109_long_min_and_various_flags.c ├── 110_long_min_and_various_flags_and_1_width.c ├── 111_long_min_and_various_flags_and_23_width.c ├── 112_long_min_and_various_flags_and_dot_precision.c ├── 113_long_min_and_various_flags_and_5_precision.c ├── 114_long_min_and_various_flags_and_1_width_and_dot_precision.c ├── 115_long_min_and_various_flags_and_23_width_and_dot_precision.c ├── 116_long_min_and_various_flags_and_1_width_and_5_precision.c ├── 117_long_min_and_various_flags_and_23_width_and_5_precision.c ├── 118_long_min_and_various_flags_combined.c ├── 119_long_min_and_various_flags_combined_and_1_width.c ├── 120_long_min_and_various_flags_combined_and_23_width.c ├── 121_long_min_and_various_flags_combined_and_dot_precision.c ├── 122_long_min_and_various_flags_combined_and_5_precision.c ├── 123_long_min_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 124_long_min_and_various_flags_combined_and_1_width_and_5_precision.c ├── 125_long_min_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 126_long_min_and_various_flags_combined_and_23_width_and_5_precision.c ├── 127_long_long_max_and_various_flags.c ├── 128_long_long_max_and_various_flags_and_1_width.c ├── 129_long_long_max_and_various_flags_and_23_width.c ├── 130_long_long_max_and_various_flags_and_dot_precision.c ├── 131_long_long_max_and_various_flags_and_5_precision.c ├── 132_long_long_max_and_various_flags_and_1_width_and_dot_precision.c ├── 133_long_long_max_and_various_flags_and_23_width_and_dot_precision.c ├── 134_long_long_max_and_various_flags_and_1_width_and_5_precision.c ├── 135_long_long_max_and_various_flags_and_23_width_and_5_precision.c ├── 136_long_long_max_and_various_flags_combined.c ├── 137_long_long_max_and_various_flags_combined_and_1_width.c ├── 138_long_long_max_and_various_flags_combined_and_23_width.c ├── 139_long_long_max_and_various_flags_combined_and_dot_precision.c ├── 140_long_long_max_and_various_flags_combined_and_5_precision.c ├── 141_long_long_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 142_long_long_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 143_long_long_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 144_long_long_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 145_long_long_max_and_various_flags_and_hh_modifier.c ├── 146_long_long_max_and_various_flags_and_1_width_and_hh_modifier.c ├── 147_long_long_max_and_various_flags_and_23_width_and_hh_modifier.c ├── 148_long_long_max_and_various_flags_and_dot_precision_and_hh_modifier.c ├── 149_long_long_max_and_various_flags_and_5_precision_and_hh_modifier.c ├── 150_long_long_max_and_various_flags_and_1_width_and_dot_precision_and_hh_modifier.c ├── 151_long_long_max_and_various_flags_and_23_width_and_dot_precision_and_hh_modifier.c ├── 152_long_long_max_and_various_flags_and_1_width_and_5_precision_and_hh_modifier.c ├── 153_long_long_max_and_various_flags_and_23_width_and_5_precision_and_hh_modifier.c ├── 154_long_long_max_and_various_flags_combined_and_hh_modifier.c ├── 155_long_long_max_and_various_flags_combined_and_1_width_and_hh_modifier.c ├── 156_long_long_max_and_various_flags_combined_and_23_width_and_hh_modifier.c ├── 157_long_long_max_and_various_flags_combined_and_dot_precision_and_hh_modifier.c ├── 158_long_long_max_and_various_flags_combined_and_5_precision_and_hh_modifier.c ├── 159_long_long_max_and_various_flags_combined_and_1_width_and_dot_precision_and_hh_modifier.c ├── 160_long_long_max_and_various_flags_combined_and_1_width_and_5_precision_and_hh_modifier.c ├── 161_long_long_max_and_various_flags_combined_and_23_width_and_dot_precision_and_hh_modifier.c ├── 162_long_long_max_and_various_flags_combined_and_23_width_and_5_precision_and_hh_modifier.c ├── 163_long_long_max_and_various_flags_and_h_modifier.c ├── 164_long_long_max_and_various_flags_and_1_width_and_h_modifier.c ├── 165_long_long_max_and_various_flags_and_23_width_and_h_modifier.c ├── 166_long_long_max_and_various_flags_and_dot_precision_and_h_modifier.c ├── 167_long_long_max_and_various_flags_and_5_precision_and_h_modifier.c ├── 168_long_long_max_and_various_flags_and_1_width_and_dot_precision_and_h_modifier.c ├── 169_long_long_max_and_various_flags_and_23_width_and_dot_precision_and_h_modifier.c ├── 170_long_long_max_and_various_flags_and_1_width_and_5_precision_and_h_modifier.c ├── 171_long_long_max_and_various_flags_and_23_width_and_5_precision_and_h_modifier.c ├── 172_long_long_max_and_various_flags_combined_and_h_modifier.c ├── 173_long_long_max_and_various_flags_combined_and_1_width_and_h_modifier.c ├── 174_long_long_max_and_various_flags_combined_and_23_width_and_h_modifier.c ├── 175_long_long_max_and_various_flags_combined_and_dot_precision_and_h_modifier.c ├── 176_long_long_max_and_various_flags_combined_and_5_precision_and_h_modifier.c ├── 177_long_long_max_and_various_flags_combined_and_1_width_and_dot_precision_and_h_modifier.c ├── 178_long_long_max_and_various_flags_combined_and_1_width_and_5_precision_and_h_modifier.c ├── 179_long_long_max_and_various_flags_combined_and_23_width_and_dot_precision_and_h_modifier.c ├── 180_long_long_max_and_various_flags_combined_and_23_width_and_5_precision_and_h_modifier.c ├── 181_long_long_max_and_various_flags_and_l_modifier.c ├── 182_long_long_max_and_various_flags_and_1_width_and_l_modifier.c ├── 183_long_long_max_and_various_flags_and_23_width_and_l_modifier.c ├── 184_long_long_max_and_various_flags_and_dot_precision_and_l_modifier.c ├── 185_long_long_max_and_various_flags_and_5_precision_and_l_modifier.c ├── 186_long_long_max_and_various_flags_and_1_width_and_dot_precision_and_l_modifier.c ├── 187_long_long_max_and_various_flags_and_23_width_and_dot_precision_and_l_modifier.c ├── 188_long_long_max_and_various_flags_and_1_width_and_5_precision_and_l_modifier.c ├── 189_long_long_max_and_various_flags_and_23_width_and_5_precision_and_l_modifier.c ├── 190_long_long_max_and_various_flags_combined_and_l_modifier.c ├── 191_long_long_max_and_various_flags_combined_and_1_width_and_l_modifier.c ├── 192_long_long_max_and_various_flags_combined_and_23_width_and_l_modifier.c ├── 193_long_long_max_and_various_flags_combined_and_dot_precision_and_l_modifier.c ├── 194_long_long_max_and_various_flags_combined_and_5_precision_and_l_modifier.c ├── 195_long_long_max_and_various_flags_combined_and_1_width_and_dot_precision_and_l_modifier.c ├── 196_long_long_max_and_various_flags_combined_and_1_width_and_5_precision_and_l_modifier.c ├── 197_long_long_max_and_various_flags_combined_and_23_width_and_dot_precision_and_l_modifier.c ├── 198_long_long_max_and_various_flags_combined_and_23_width_and_5_precision_and_l_modifier.c ├── 199_long_long_max_and_various_flags_and_ll_modifier.c ├── 200_long_long_max_and_various_flags_and_1_width_and_ll_modifier.c ├── 201_long_long_max_and_various_flags_and_23_width_and_ll_modifier.c ├── 202_long_long_max_and_various_flags_and_dot_precision_and_ll_modifier.c ├── 203_long_long_max_and_various_flags_and_5_precision_and_ll_modifier.c ├── 204_long_long_max_and_various_flags_and_1_width_and_dot_precision_and_ll_modifier.c ├── 205_long_long_max_and_various_flags_and_23_width_and_dot_precision_and_ll_modifier.c ├── 206_long_long_max_and_various_flags_and_1_width_and_5_precision_and_ll_modifier.c ├── 207_long_long_max_and_various_flags_and_23_width_and_5_precision_and_ll_modifier.c ├── 208_long_long_max_and_various_flags_combined_and_ll_modifier.c ├── 209_long_long_max_and_various_flags_combined_and_1_width_and_ll_modifier.c ├── 210_long_long_max_and_various_flags_combined_and_23_width_and_ll_modifier.c ├── 211_long_long_max_and_various_flags_combined_and_dot_precision_and_ll_modifier.c ├── 212_long_long_max_and_various_flags_combined_and_5_precision_and_ll_modifier.c ├── 213_long_long_max_and_various_flags_combined_and_1_width_and_dot_precision_and_ll_modifier.c ├── 214_long_long_max_and_various_flags_combined_and_1_width_and_5_precision_and_ll_modifier.c ├── 215_long_long_max_and_various_flags_combined_and_23_width_and_dot_precision_and_ll_modifier.c ├── 216_long_long_max_and_various_flags_combined_and_23_width_and_5_precision_and_ll_modifier.c ├── 217_long_long_min_and_various_flags.c ├── 218_long_long_min_and_various_flags_and_1_width.c ├── 219_long_long_min_and_various_flags_and_23_width.c ├── 220_long_long_min_and_various_flags_and_dot_precision.c ├── 221_long_long_min_and_various_flags_and_5_precision.c ├── 222_long_long_min_and_various_flags_and_1_width_and_dot_precision.c ├── 223_long_long_min_and_various_flags_and_23_width_and_dot_precision.c ├── 224_long_long_min_and_various_flags_and_1_width_and_5_precision.c ├── 225_long_long_min_and_various_flags_and_23_width_and_5_precision.c ├── 226_long_long_min_and_various_flags_combined.c ├── 227_long_long_min_and_various_flags_combined_and_1_width.c ├── 228_long_long_min_and_various_flags_combined_and_23_width.c ├── 229_long_long_min_and_various_flags_combined_and_dot_precision.c ├── 230_long_long_min_and_various_flags_combined_and_5_precision.c ├── 231_long_long_min_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 232_long_long_min_and_various_flags_combined_and_1_width_and_5_precision.c ├── 233_long_long_min_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 234_long_long_min_and_various_flags_combined_and_23_width_and_5_precision.c ├── 235_long_long_min_and_various_flags_and_hh_modifier.c ├── 236_long_long_min_and_various_flags_and_1_width_and_hh_modifier.c ├── 237_long_long_min_and_various_flags_and_23_width_and_hh_modifier.c ├── 238_long_long_min_and_various_flags_and_dot_precision_and_hh_modifier.c ├── 239_long_long_min_and_various_flags_and_5_precision_and_hh_modifier.c ├── 240_long_long_min_and_various_flags_and_1_width_and_dot_precision_and_hh_modifier.c ├── 241_long_long_min_and_various_flags_and_23_width_and_dot_precision_and_hh_modifier.c ├── 242_long_long_min_and_various_flags_and_1_width_and_5_precision_and_hh_modifier.c ├── 243_long_long_min_and_various_flags_and_23_width_and_5_precision_and_hh_modifier.c ├── 244_long_long_min_and_various_flags_combined_and_hh_modifier.c ├── 245_long_long_min_and_various_flags_combined_and_1_width_and_hh_modifier.c ├── 246_long_long_min_and_various_flags_combined_and_23_width_and_hh_modifier.c ├── 247_long_long_min_and_various_flags_combined_and_dot_precision_and_hh_modifier.c ├── 248_long_long_min_and_various_flags_combined_and_5_precision_and_hh_modifier.c ├── 249_long_long_min_and_various_flags_combined_and_1_width_and_dot_precision_and_hh_modifier.c ├── 250_long_long_min_and_various_flags_combined_and_1_width_and_5_precision_and_hh_modifier.c ├── 251_long_long_min_and_various_flags_combined_and_23_width_and_dot_precision_and_hh_modifier.c ├── 252_long_long_min_and_various_flags_combined_and_23_width_and_5_precision_and_hh_modifier.c ├── 253_long_long_min_and_various_flags_and_h_modifier.c ├── 254_long_long_min_and_various_flags_and_1_width_and_h_modifier.c ├── 255_long_long_min_and_various_flags_and_23_width_and_h_modifier.c ├── 256_long_long_min_and_various_flags_and_dot_precision_and_h_modifier.c ├── 257_long_long_min_and_various_flags_and_5_precision_and_h_modifier.c ├── 258_long_long_min_and_various_flags_and_1_width_and_dot_precision_and_h_modifier.c ├── 259_long_long_min_and_various_flags_and_23_width_and_dot_precision_and_h_modifier.c ├── 260_long_long_min_and_various_flags_and_1_width_and_5_precision_and_h_modifier.c ├── 261_long_long_min_and_various_flags_and_23_width_and_5_precision_and_h_modifier.c ├── 262_long_long_min_and_various_flags_combined_and_h_modifier.c ├── 263_long_long_min_and_various_flags_combined_and_1_width_and_h_modifier.c ├── 264_long_long_min_and_various_flags_combined_and_23_width_and_h_modifier.c ├── 265_long_long_min_and_various_flags_combined_and_dot_precision_and_h_modifier.c ├── 266_long_long_min_and_various_flags_combined_and_5_precision_and_h_modifier.c ├── 267_long_long_min_and_various_flags_combined_and_1_width_and_dot_precision_and_h_modifier.c ├── 268_long_long_min_and_various_flags_combined_and_1_width_and_5_precision_and_h_modifier.c ├── 269_long_long_min_and_various_flags_combined_and_23_width_and_dot_precision_and_h_modifier.c ├── 270_long_long_min_and_various_flags_combined_and_23_width_and_5_precision_and_h_modifier.c ├── 271_long_long_min_and_various_flags_and_l_modifier.c ├── 272_long_long_min_and_various_flags_and_1_width_and_l_modifier.c ├── 273_long_long_min_and_various_flags_and_23_width_and_l_modifier.c ├── 274_long_long_min_and_various_flags_and_dot_precision_and_l_modifier.c ├── 275_long_long_min_and_various_flags_and_5_precision_and_l_modifier.c ├── 276_long_long_min_and_various_flags_and_1_width_and_dot_precision_and_l_modifier.c ├── 277_long_long_min_and_various_flags_and_23_width_and_dot_precision_and_l_modifier.c ├── 278_long_long_min_and_various_flags_and_1_width_and_5_precision_and_l_modifier.c ├── 279_long_long_min_and_various_flags_and_23_width_and_5_precision_and_l_modifier.c ├── 280_long_long_min_and_various_flags_combined_and_l_modifier.c ├── 281_long_long_min_and_various_flags_combined_and_1_width_and_l_modifier.c ├── 282_long_long_min_and_various_flags_combined_and_23_width_and_l_modifier.c ├── 283_long_long_min_and_various_flags_combined_and_dot_precision_and_l_modifier.c ├── 284_long_long_min_and_various_flags_combined_and_5_precision_and_l_modifier.c ├── 285_long_long_min_and_various_flags_combined_and_1_width_and_dot_precision_and_l_modifier.c ├── 286_long_long_min_and_various_flags_combined_and_1_width_and_5_precision_and_l_modifier.c ├── 287_long_long_min_and_various_flags_combined_and_23_width_and_dot_precision_and_l_modifier.c ├── 288_long_long_min_and_various_flags_combined_and_23_width_and_5_precision_and_l_modifier.c ├── 289_long_long_min_and_various_flags_and_ll_modifier.c ├── 290_long_long_min_and_various_flags_and_1_width_and_ll_modifier.c ├── 291_long_long_min_and_various_flags_and_23_width_and_ll_modifier.c ├── 292_long_long_min_and_various_flags_and_dot_precision_and_ll_modifier.c ├── 293_long_long_min_and_various_flags_and_5_precision_and_ll_modifier.c ├── 294_long_long_min_and_various_flags_and_1_width_and_dot_precision_and_ll_modifier.c ├── 295_long_long_min_and_various_flags_and_23_width_and_dot_precision_and_ll_modifier.c ├── 296_long_long_min_and_various_flags_and_1_width_and_5_precision_and_ll_modifier.c ├── 297_long_long_min_and_various_flags_and_23_width_and_5_precision_and_ll_modifier.c ├── 298_long_long_min_and_various_flags_combined_and_ll_modifier.c ├── 299_long_long_min_and_various_flags_combined_and_1_width_and_ll_modifier.c ├── 300_long_long_min_and_various_flags_combined_and_23_width_and_ll_modifier.c ├── 301_long_long_min_and_various_flags_combined_and_dot_precision_and_ll_modifier.c ├── 302_long_long_min_and_various_flags_combined_and_5_precision_and_ll_modifier.c ├── 303_long_long_min_and_various_flags_combined_and_1_width_and_dot_precision_and_ll_modifier.c ├── 304_long_long_min_and_various_flags_combined_and_1_width_and_5_precision_and_ll_modifier.c ├── 305_long_long_min_and_various_flags_combined_and_23_width_and_dot_precision_and_ll_modifier.c ├── 306_long_long_min_and_various_flags_combined_and_23_width_and_5_precision_and_ll_modifier.c └── conv_i.h ├── conv_o ├── 000_launcher.c ├── 001_zero_and_various_flags.c ├── 002_zero_and_various_flags_and_1_width.c ├── 003_zero_and_various_flags_and_23_width.c ├── 004_zero_and_various_flags_and_dot_precision.c ├── 005_zero_and_various_flags_and_5_precision.c ├── 006_zero_and_various_flags_and_1_width_and_dot_precision.c ├── 007_zero_and_various_flags_and_23_width_and_dot_precision.c ├── 008_zero_and_various_flags_and_1_width_and_5_precision.c ├── 009_zero_and_various_flags_and_23_width_and_5_precision.c ├── 010_zero_and_various_flags_combined.c ├── 011_zero_and_various_flags_combined_and_1_width.c ├── 012_zero_and_various_flags_combined_and_23_width.c ├── 013_zero_and_various_flags_combined_and_dot_precision.c ├── 014_zero_and_various_flags_combined_and_5_precision.c ├── 015_zero_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 016_zero_and_various_flags_combined_and_1_width_and_5_precision.c ├── 017_zero_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 018_zero_and_various_flags_combined_and_23_width_and_5_precision.c ├── 019_uint_max_and_various_flags.c ├── 020_uint_max_and_various_flags_and_1_width.c ├── 021_uint_max_and_various_flags_and_23_width.c ├── 022_uint_max_and_various_flags_and_dot_precision.c ├── 023_uint_max_and_various_flags_and_5_precision.c ├── 024_uint_max_and_various_flags_and_1_width_and_dot_precision.c ├── 025_uint_max_and_various_flags_and_23_width_and_dot_precision.c ├── 026_uint_max_and_various_flags_and_1_width_and_5_precision.c ├── 027_uint_max_and_various_flags_and_23_width_and_5_precision.c ├── 028_uint_max_and_various_flags_combined.c ├── 029_uint_max_and_various_flags_combined_and_1_width.c ├── 030_uint_max_and_various_flags_combined_and_23_width.c ├── 031_uint_max_and_various_flags_combined_and_dot_precision.c ├── 032_uint_max_and_various_flags_combined_and_5_precision.c ├── 033_uint_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 034_uint_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 035_uint_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 036_uint_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 037_ulong_max_and_various_flags.c ├── 038_ulong_max_and_various_flags_and_1_width.c ├── 039_ulong_max_and_various_flags_and_23_width.c ├── 040_ulong_max_and_various_flags_and_dot_precision.c ├── 041_ulong_max_and_various_flags_and_5_precision.c ├── 042_ulong_max_and_various_flags_and_1_width_and_dot_precision.c ├── 043_ulong_max_and_various_flags_and_23_width_and_dot_precision.c ├── 044_ulong_max_and_various_flags_and_1_width_and_5_precision.c ├── 045_ulong_max_and_various_flags_and_23_width_and_5_precision.c ├── 046_ulong_max_and_various_flags_combined.c ├── 047_ulong_max_and_various_flags_combined_and_1_width.c ├── 048_ulong_max_and_various_flags_combined_and_23_width.c ├── 049_ulong_max_and_various_flags_combined_and_dot_precision.c ├── 050_ulong_max_and_various_flags_combined_and_5_precision.c ├── 051_ulong_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 052_ulong_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 053_ulong_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 054_ulong_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 055_ullong_max_and_various_flags.c ├── 056_ullong_max_and_various_flags_and_1_width.c ├── 057_ullong_max_and_various_flags_and_23_width.c ├── 058_ullong_max_and_various_flags_and_dot_precision.c ├── 059_ullong_max_and_various_flags_and_5_precision.c ├── 060_ullong_max_and_various_flags_and_1_width_and_dot_precision.c ├── 061_ullong_max_and_various_flags_and_23_width_and_dot_precision.c ├── 062_ullong_max_and_various_flags_and_1_width_and_5_precision.c ├── 063_ullong_max_and_various_flags_and_23_width_and_5_precision.c ├── 064_ullong_max_and_various_flags_combined.c ├── 065_ullong_max_and_various_flags_combined_and_1_width.c ├── 066_ullong_max_and_various_flags_combined_and_23_width.c ├── 067_ullong_max_and_various_flags_combined_and_dot_precision.c ├── 068_ullong_max_and_various_flags_combined_and_5_precision.c ├── 069_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 070_ullong_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 071_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 072_ullong_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 073_ullong_max_and_various_flags_hh_modifier.c ├── 074_ullong_max_and_various_flags_and_1_width_hh_modifier.c ├── 075_ullong_max_and_various_flags_and_23_width_hh_modifier.c ├── 076_ullong_max_and_various_flags_and_dot_precision_hh_modifier.c ├── 077_ullong_max_and_various_flags_and_5_precision_hh_modifier.c ├── 078_ullong_max_and_various_flags_and_1_width_and_dot_precision_hh_modifier.c ├── 079_ullong_max_and_various_flags_and_23_width_and_dot_precision_hh_modifier.c ├── 080_ullong_max_and_various_flags_and_1_width_and_5_precision_hh_modifier.c ├── 081_ullong_max_and_various_flags_and_23_width_and_5_precision_hh_modifier.c ├── 082_ullong_max_and_various_flags_combined_hh_modifier.c ├── 083_ullong_max_and_various_flags_combined_and_1_width_hh_modifier.c ├── 084_ullong_max_and_various_flags_combined_and_23_width_hh_modifier.c ├── 085_ullong_max_and_various_flags_combined_and_dot_precision_hh_modifier.c ├── 086_ullong_max_and_various_flags_combined_and_5_precision_hh_modifier.c ├── 087_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_hh_modifier.c ├── 088_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_hh_modifier.c ├── 089_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_hh_modifier.c ├── 090_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_hh_modifier.c ├── 091_ullong_max_and_various_flags_h_modifier.c ├── 092_ullong_max_and_various_flags_and_1_width_h_modifier.c ├── 093_ullong_max_and_various_flags_and_23_width_h_modifier.c ├── 094_ullong_max_and_various_flags_and_dot_precision_h_modifier.c ├── 095_ullong_max_and_various_flags_and_5_precision_h_modifier.c ├── 096_ullong_max_and_various_flags_and_1_width_and_dot_precision_h_modifier.c ├── 097_ullong_max_and_various_flags_and_23_width_and_dot_precision_h_modifier.c ├── 098_ullong_max_and_various_flags_and_1_width_and_5_precision_h_modifier.c ├── 099_ullong_max_and_various_flags_and_23_width_and_5_precision_h_modifier.c ├── 100_ullong_max_and_various_flags_combined_h_modifier.c ├── 101_ullong_max_and_various_flags_combined_and_1_width_h_modifier.c ├── 102_ullong_max_and_various_flags_combined_and_23_width_h_modifier.c ├── 103_ullong_max_and_various_flags_combined_and_dot_precision_h_modifier.c ├── 104_ullong_max_and_various_flags_combined_and_5_precision_h_modifier.c ├── 105_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_h_modifier.c ├── 106_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_h_modifier.c ├── 107_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_h_modifier.c ├── 108_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_h_modifier.c ├── 109_ullong_max_and_various_flags_l_modifier.c ├── 110_ullong_max_and_various_flags_and_1_width_l_modifier.c ├── 111_ullong_max_and_various_flags_and_23_width_l_modifier.c ├── 112_ullong_max_and_various_flags_and_dot_precision_l_modifier.c ├── 113_ullong_max_and_various_flags_and_5_precision_l_modifier.c ├── 114_ullong_max_and_various_flags_and_1_width_and_dot_precision_l_modifier.c ├── 115_ullong_max_and_various_flags_and_23_width_and_dot_precision_l_modifier.c ├── 116_ullong_max_and_various_flags_and_1_width_and_5_precision_l_modifier.c ├── 117_ullong_max_and_various_flags_and_23_width_and_5_precision_l_modifier.c ├── 118_ullong_max_and_various_flags_combined_l_modifier.c ├── 119_ullong_max_and_various_flags_combined_and_1_width_l_modifier.c ├── 120_ullong_max_and_various_flags_combined_and_23_width_l_modifier.c ├── 121_ullong_max_and_various_flags_combined_and_dot_precision_l_modifier.c ├── 122_ullong_max_and_various_flags_combined_and_5_precision_l_modifier.c ├── 123_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_l_modifier.c ├── 124_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_l_modifier.c ├── 125_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_l_modifier.c ├── 126_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_l_modifier.c ├── 127_ullong_max_and_various_flags_ll_modifier.c ├── 128_ullong_max_and_various_flags_and_1_width_ll_modifier.c ├── 129_ullong_max_and_various_flags_and_23_width_ll_modifier.c ├── 130_ullong_max_and_various_flags_and_dot_precision_ll_modifier.c ├── 131_ullong_max_and_various_flags_and_5_precision_ll_modifier.c ├── 132_ullong_max_and_various_flags_and_1_width_and_dot_precision_ll_modifier.c ├── 133_ullong_max_and_various_flags_and_23_width_and_dot_precision_ll_modifier.c ├── 134_ullong_max_and_various_flags_and_1_width_and_5_precision_ll_modifier.c ├── 135_ullong_max_and_various_flags_and_23_width_and_5_precision_ll_modifier.c ├── 136_ullong_max_and_various_flags_combined_ll_modifier.c ├── 137_ullong_max_and_various_flags_combined_and_1_width_ll_modifier.c ├── 138_ullong_max_and_various_flags_combined_and_23_width_ll_modifier.c ├── 139_ullong_max_and_various_flags_combined_and_dot_precision_ll_modifier.c ├── 140_ullong_max_and_various_flags_combined_and_5_precision_ll_modifier.c ├── 141_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_ll_modifier.c ├── 142_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_ll_modifier.c ├── 143_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_ll_modifier.c ├── 144_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_ll_modifier.c └── conv_o.h ├── conv_p ├── 000_launcher.c ├── 001_null_pointer.c ├── 002_random_string.c ├── 003_random_string_and_5_width.c ├── 004_random_string_and_30_width.c ├── 005_random_string_and_minus_flag_and_30_width.c ├── 006_function_pointer.c └── conv_p.h ├── conv_s ├── 000_launcher.c ├── 001_null_pointer_various_flags.c ├── 002_random_string_various_flags.c ├── 003_emoticone_various_flags.c ├── 004_emoticone_utf8_encoded_various_flags.c ├── 005_string_format_and_random_string.c ├── 006_string_format_and_random_string_and_width.c ├── 007_string_format_and_random_string_and_precision.c ├── 008_multiple_random_strings.c ├── 009_only_string_conv.c ├── 010_very_long_string.c └── conv_s.h ├── conv_u ├── 000_launcher.c ├── 001_zero_and_various_flags.c ├── 002_zero_and_various_flags_and_1_width.c ├── 003_zero_and_various_flags_and_23_width.c ├── 004_zero_and_various_flags_and_dot_precision.c ├── 005_zero_and_various_flags_and_5_precision.c ├── 006_zero_and_various_flags_and_1_width_and_dot_precision.c ├── 007_zero_and_various_flags_and_23_width_and_dot_precision.c ├── 008_zero_and_various_flags_and_1_width_and_5_precision.c ├── 009_zero_and_various_flags_and_23_width_and_5_precision.c ├── 010_zero_and_various_flags_combined.c ├── 011_zero_and_various_flags_combined_and_1_width.c ├── 012_zero_and_various_flags_combined_and_23_width.c ├── 013_zero_and_various_flags_combined_and_dot_precision.c ├── 014_zero_and_various_flags_combined_and_5_precision.c ├── 015_zero_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 016_zero_and_various_flags_combined_and_1_width_and_5_precision.c ├── 017_zero_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 018_zero_and_various_flags_combined_and_23_width_and_5_precision.c ├── 019_uint_max_and_various_flags.c ├── 020_uint_max_and_various_flags_and_1_width.c ├── 021_uint_max_and_various_flags_and_23_width.c ├── 022_uint_max_and_various_flags_and_dot_precision.c ├── 023_uint_max_and_various_flags_and_5_precision.c ├── 024_uint_max_and_various_flags_and_1_width_and_dot_precision.c ├── 025_uint_max_and_various_flags_and_23_width_and_dot_precision.c ├── 026_uint_max_and_various_flags_and_1_width_and_5_precision.c ├── 027_uint_max_and_various_flags_and_23_width_and_5_precision.c ├── 028_uint_max_and_various_flags_combined.c ├── 029_uint_max_and_various_flags_combined_and_1_width.c ├── 030_uint_max_and_various_flags_combined_and_23_width.c ├── 031_uint_max_and_various_flags_combined_and_dot_precision.c ├── 032_uint_max_and_various_flags_combined_and_5_precision.c ├── 033_uint_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 034_uint_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 035_uint_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 036_uint_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 037_ulong_max_and_various_flags.c ├── 038_ulong_max_and_various_flags_and_1_width.c ├── 039_ulong_max_and_various_flags_and_23_width.c ├── 040_ulong_max_and_various_flags_and_dot_precision.c ├── 041_ulong_max_and_various_flags_and_5_precision.c ├── 042_ulong_max_and_various_flags_and_1_width_and_dot_precision.c ├── 043_ulong_max_and_various_flags_and_23_width_and_dot_precision.c ├── 044_ulong_max_and_various_flags_and_1_width_and_5_precision.c ├── 045_ulong_max_and_various_flags_and_23_width_and_5_precision.c ├── 046_ulong_max_and_various_flags_combined.c ├── 047_ulong_max_and_various_flags_combined_and_1_width.c ├── 048_ulong_max_and_various_flags_combined_and_23_width.c ├── 049_ulong_max_and_various_flags_combined_and_dot_precision.c ├── 050_ulong_max_and_various_flags_combined_and_5_precision.c ├── 051_ulong_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 052_ulong_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 053_ulong_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 054_ulong_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 055_ullong_max_and_various_flags.c ├── 056_ullong_max_and_various_flags_and_1_width.c ├── 057_ullong_max_and_various_flags_and_23_width.c ├── 058_ullong_max_and_various_flags_and_dot_precision.c ├── 059_ullong_max_and_various_flags_and_5_precision.c ├── 060_ullong_max_and_various_flags_and_1_width_and_dot_precision.c ├── 061_ullong_max_and_various_flags_and_23_width_and_dot_precision.c ├── 062_ullong_max_and_various_flags_and_1_width_and_5_precision.c ├── 063_ullong_max_and_various_flags_and_23_width_and_5_precision.c ├── 064_ullong_max_and_various_flags_combined.c ├── 065_ullong_max_and_various_flags_combined_and_1_width.c ├── 066_ullong_max_and_various_flags_combined_and_23_width.c ├── 067_ullong_max_and_various_flags_combined_and_dot_precision.c ├── 068_ullong_max_and_various_flags_combined_and_5_precision.c ├── 069_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 070_ullong_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 071_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 072_ullong_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 073_ullong_max_and_various_flags_hh_modifier_hh_modifier.c ├── 074_ullong_max_and_various_flags_and_1_width_hh_modifier.c ├── 075_ullong_max_and_various_flags_and_23_width_hh_modifier.c ├── 076_ullong_max_and_various_flags_and_dot_precision_hh_modifier.c ├── 077_ullong_max_and_various_flags_and_5_precision_hh_modifier.c ├── 078_ullong_max_and_various_flags_and_1_width_and_dot_precision_hh_modifier.c ├── 079_ullong_max_and_various_flags_and_23_width_and_dot_precision_hh_modifier.c ├── 080_ullong_max_and_various_flags_and_1_width_and_5_precision_hh_modifier.c ├── 081_ullong_max_and_various_flags_and_23_width_and_5_precision_hh_modifier.c ├── 082_ullong_max_and_various_flags_combined_hh_modifier.c ├── 083_ullong_max_and_various_flags_combined_and_1_width_hh_modifier.c ├── 084_ullong_max_and_various_flags_combined_and_23_width_hh_modifier.c ├── 085_ullong_max_and_various_flags_combined_and_dot_precision_hh_modifier.c ├── 086_ullong_max_and_various_flags_combined_and_5_precision_hh_modifier.c ├── 087_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_hh_modifier.c ├── 088_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_hh_modifier.c ├── 089_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_hh_modifier.c ├── 090_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_hh_modifier.c ├── 091_ullong_max_and_various_flags_h.c ├── 092_ullong_max_and_various_flags_and_1_width_h_modifier.c ├── 093_ullong_max_and_various_flags_and_23_width_h_modifier.c ├── 094_ullong_max_and_various_flags_and_dot_precision_h_modifier.c ├── 095_ullong_max_and_various_flags_and_5_precision_h_modifier.c ├── 096_ullong_max_and_various_flags_and_1_width_and_dot_precision_h_modifier.c ├── 097_ullong_max_and_various_flags_and_23_width_and_dot_precision_h_modifier.c ├── 098_ullong_max_and_various_flags_and_1_width_and_5_precision_h_modifier.c ├── 099_ullong_max_and_various_flags_and_23_width_and_5_precision_h_modifier.c ├── 100_ullong_max_and_various_flags_combined_h_modifier.c ├── 101_ullong_max_and_various_flags_combined_and_1_width_h_modifier.c ├── 102_ullong_max_and_various_flags_combined_and_23_width_h_modifier.c ├── 103_ullong_max_and_various_flags_combined_and_dot_precision_h_modifier.c ├── 104_ullong_max_and_various_flags_combined_and_5_precision_h_modifier.c ├── 105_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_h_modifier.c ├── 106_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_h_modifier.c ├── 107_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_h_modifier.c ├── 108_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_h_modifier.c ├── 109_ullong_max_and_various_flags_l_modifier.c ├── 110_ullong_max_and_various_flags_and_1_width_l_modifier.c ├── 111_ullong_max_and_various_flags_and_23_width_l_modifier.c ├── 112_ullong_max_and_various_flags_and_dot_precision_l_modifier.c ├── 113_ullong_max_and_various_flags_and_5_precision_l_modifier.c ├── 114_ullong_max_and_various_flags_and_1_width_and_dot_precision_l_modifier.c ├── 115_ullong_max_and_various_flags_and_23_width_and_dot_precision_l_modifier.c ├── 116_ullong_max_and_various_flags_and_1_width_and_5_precision_l_modifier.c ├── 117_ullong_max_and_various_flags_and_23_width_and_5_precision_l_modifier.c ├── 118_ullong_max_and_various_flags_combined_l_modifier.c ├── 119_ullong_max_and_various_flags_combined_and_1_width_l_modifier.c ├── 120_ullong_max_and_various_flags_combined_and_23_width_l_modifier.c ├── 121_ullong_max_and_various_flags_combined_and_dot_precision_l_modifier.c ├── 122_ullong_max_and_various_flags_combined_and_5_precision_l_modifier.c ├── 123_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_l_modifier.c ├── 124_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_l_modifier.c ├── 125_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_l_modifier.c ├── 126_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_l_modifier.c ├── 127_ullong_max_and_various_flags_ll_modifier.c ├── 128_ullong_max_and_various_flags_and_1_width_ll_modifier.c ├── 129_ullong_max_and_various_flags_and_23_width_ll_modifier.c ├── 130_ullong_max_and_various_flags_and_dot_precision_ll_modifier.c ├── 131_ullong_max_and_various_flags_and_5_precision_ll_modifier.c ├── 132_ullong_max_and_various_flags_and_1_width_and_dot_precision_ll_modifier.c ├── 133_ullong_max_and_various_flags_and_23_width_and_dot_precision_ll_modifier.c ├── 134_ullong_max_and_various_flags_and_1_width_and_5_precision_ll_modifier.c ├── 135_ullong_max_and_various_flags_and_23_width_and_5_precision_ll_modifier.c ├── 136_ullong_max_and_various_flags_combined_ll_modifier.c ├── 137_ullong_max_and_various_flags_combined_and_1_width_ll_modifier.c ├── 138_ullong_max_and_various_flags_combined_and_23_width_ll_modifier.c ├── 139_ullong_max_and_various_flags_combined_and_dot_precision_ll_modifier.c ├── 140_ullong_max_and_various_flags_combined_and_5_precision_ll_modifier.c ├── 141_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_ll_modifier.c ├── 142_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_ll_modifier.c ├── 143_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_ll_modifier.c ├── 144_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_ll_modifier.c └── conv_u.h ├── conv_x ├── 000_launcher.c ├── 001_zero_and_various_flags.c ├── 002_zero_and_various_flags_and_1_width.c ├── 003_zero_and_various_flags_and_23_width.c ├── 004_zero_and_various_flags_and_dot_precision.c ├── 005_zero_and_various_flags_and_5_precision.c ├── 006_zero_and_various_flags_and_1_width_and_dot_precision.c ├── 007_zero_and_various_flags_and_23_width_and_dot_precision.c ├── 008_zero_and_various_flags_and_1_width_and_5_precision.c ├── 009_zero_and_various_flags_and_23_width_and_5_precision.c ├── 010_zero_and_various_flags_combined.c ├── 011_zero_and_various_flags_combined_and_1_width.c ├── 012_zero_and_various_flags_combined_and_23_width.c ├── 013_zero_and_various_flags_combined_and_dot_precision.c ├── 014_zero_and_various_flags_combined_and_5_precision.c ├── 015_zero_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 016_zero_and_various_flags_combined_and_1_width_and_5_precision.c ├── 017_zero_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 018_zero_and_various_flags_combined_and_23_width_and_5_precision.c ├── 019_uint_max_and_various_flags.c ├── 020_uint_max_and_various_flags_and_1_width.c ├── 021_uint_max_and_various_flags_and_23_width.c ├── 022_uint_max_and_various_flags_and_dot_precision.c ├── 023_uint_max_and_various_flags_and_5_precision.c ├── 024_uint_max_and_various_flags_and_1_width_and_dot_precision.c ├── 025_uint_max_and_various_flags_and_23_width_and_dot_precision.c ├── 026_uint_max_and_various_flags_and_1_width_and_5_precision.c ├── 027_uint_max_and_various_flags_and_23_width_and_5_precision.c ├── 028_uint_max_and_various_flags_combined.c ├── 029_uint_max_and_various_flags_combined_and_1_width.c ├── 030_uint_max_and_various_flags_combined_and_23_width.c ├── 031_uint_max_and_various_flags_combined_and_dot_precision.c ├── 032_uint_max_and_various_flags_combined_and_5_precision.c ├── 033_uint_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 034_uint_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 035_uint_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 036_uint_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 037_ulong_max_and_various_flags.c ├── 038_ulong_max_and_various_flags_and_1_width.c ├── 039_ulong_max_and_various_flags_and_23_width.c ├── 040_ulong_max_and_various_flags_and_dot_precision.c ├── 041_ulong_max_and_various_flags_and_5_precision.c ├── 042_ulong_max_and_various_flags_and_1_width_and_dot_precision.c ├── 043_ulong_max_and_various_flags_and_23_width_and_dot_precision.c ├── 044_ulong_max_and_various_flags_and_1_width_and_5_precision.c ├── 045_ulong_max_and_various_flags_and_23_width_and_5_precision.c ├── 046_ulong_max_and_various_flags_combined.c ├── 047_ulong_max_and_various_flags_combined_and_1_width.c ├── 048_ulong_max_and_various_flags_combined_and_23_width.c ├── 049_ulong_max_and_various_flags_combined_and_dot_precision.c ├── 050_ulong_max_and_various_flags_combined_and_5_precision.c ├── 051_ulong_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 052_ulong_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 053_ulong_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 054_ulong_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 055_ullong_max_and_various_flags.c ├── 056_ullong_max_and_various_flags_and_1_width.c ├── 057_ullong_max_and_various_flags_and_23_width.c ├── 058_ullong_max_and_various_flags_and_dot_precision.c ├── 059_ullong_max_and_various_flags_and_5_precision.c ├── 060_ullong_max_and_various_flags_and_1_width_and_dot_precision.c ├── 061_ullong_max_and_various_flags_and_23_width_and_dot_precision.c ├── 062_ullong_max_and_various_flags_and_1_width_and_5_precision.c ├── 063_ullong_max_and_various_flags_and_23_width_and_5_precision.c ├── 064_ullong_max_and_various_flags_combined.c ├── 065_ullong_max_and_various_flags_combined_and_1_width.c ├── 066_ullong_max_and_various_flags_combined_and_23_width.c ├── 067_ullong_max_and_various_flags_combined_and_dot_precision.c ├── 068_ullong_max_and_various_flags_combined_and_5_precision.c ├── 069_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision.c ├── 070_ullong_max_and_various_flags_combined_and_1_width_and_5_precision.c ├── 071_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision.c ├── 072_ullong_max_and_various_flags_combined_and_23_width_and_5_precision.c ├── 073_ullong_max_and_various_flags_hh_modifier.c ├── 074_ullong_max_and_various_flags_and_1_width_hh_modifier.c ├── 075_ullong_max_and_various_flags_and_23_width_hh_modifier.c ├── 076_ullong_max_and_various_flags_and_dot_precision_hh_modifier.c ├── 077_ullong_max_and_various_flags_and_5_precision_hh_modifier.c ├── 078_ullong_max_and_various_flags_and_1_width_and_dot_precision_hh_modifier.c ├── 079_ullong_max_and_various_flags_and_23_width_and_dot_precision_hh_modifier.c ├── 080_ullong_max_and_various_flags_and_1_width_and_5_precision_hh_modifier.c ├── 081_ullong_max_and_various_flags_and_23_width_and_5_precision_hh_modifier.c ├── 082_ullong_max_and_various_flags_combined_hh_modifier.c ├── 083_ullong_max_and_various_flags_combined_and_1_width_hh_modifier.c ├── 084_ullong_max_and_various_flags_combined_and_23_width_hh_modifier.c ├── 085_ullong_max_and_various_flags_combined_and_dot_precision_hh_modifier.c ├── 086_ullong_max_and_various_flags_combined_and_5_precision_hh_modifier.c ├── 087_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_hh_modifier.c ├── 088_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_hh_modifier.c ├── 089_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_hh_modifier.c ├── 090_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_hh_modifier.c ├── 091_ullong_max_and_various_flags_h_modifier.c ├── 092_ullong_max_and_various_flags_and_1_width_h_modifier.c ├── 093_ullong_max_and_various_flags_and_23_width_h_modifier.c ├── 094_ullong_max_and_various_flags_and_dot_precision_h_modifier.c ├── 095_ullong_max_and_various_flags_and_5_precision_h_modifier.c ├── 096_ullong_max_and_various_flags_and_1_width_and_dot_precision_h_modifier.c ├── 097_ullong_max_and_various_flags_and_23_width_and_dot_precision_h_modifier.c ├── 098_ullong_max_and_various_flags_and_1_width_and_5_precision_h_modifier.c ├── 099_ullong_max_and_various_flags_and_23_width_and_5_precision_h_modifier.c ├── 100_ullong_max_and_various_flags_combined_h_modifier.c ├── 101_ullong_max_and_various_flags_combined_and_1_width_h_modifier.c ├── 102_ullong_max_and_various_flags_combined_and_23_width_h_modifier.c ├── 103_ullong_max_and_various_flags_combined_and_dot_precision_h_modifier.c ├── 104_ullong_max_and_various_flags_combined_and_5_precision_h_modifier.c ├── 105_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_h_modifier.c ├── 106_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_h_modifier.c ├── 107_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_h_modifier.c ├── 108_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_h_modifier.c ├── 109_ullong_max_and_various_flags_l_modifier.c ├── 110_ullong_max_and_various_flags_and_1_width_l_modifier.c ├── 111_ullong_max_and_various_flags_and_23_width_l_modifier.c ├── 112_ullong_max_and_various_flags_and_dot_precision_l_modifier.c ├── 113_ullong_max_and_various_flags_and_5_precision_l_modifier.c ├── 114_ullong_max_and_various_flags_and_1_width_and_dot_precision_l_modifier.c ├── 115_ullong_max_and_various_flags_and_23_width_and_dot_precision_l_modifier.c ├── 116_ullong_max_and_various_flags_and_1_width_and_5_precision_l_modifier.c ├── 117_ullong_max_and_various_flags_and_23_width_and_5_precision_l_modifier.c ├── 118_ullong_max_and_various_flags_combined_l_modifier.c ├── 119_ullong_max_and_various_flags_combined_and_1_width_l_modifier.c ├── 120_ullong_max_and_various_flags_combined_and_23_width_l_modifier.c ├── 121_ullong_max_and_various_flags_combined_and_dot_precision_l_modifier.c ├── 122_ullong_max_and_various_flags_combined_and_5_precision_l_modifier.c ├── 123_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_l_modifier.c ├── 124_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_l_modifier.c ├── 125_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_l_modifier.c ├── 126_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_l_modifier.c ├── 127_ullong_max_and_various_flags_ll_modifier.c ├── 128_ullong_max_and_various_flags_and_1_width_ll_modifier.c ├── 129_ullong_max_and_various_flags_and_23_width_ll_modifier.c ├── 130_ullong_max_and_various_flags_and_dot_precision_ll_modifier.c ├── 131_ullong_max_and_various_flags_and_5_precision_ll_modifier.c ├── 132_ullong_max_and_various_flags_and_1_width_and_dot_precision_ll_modifier.c ├── 133_ullong_max_and_various_flags_and_23_width_and_dot_precision_ll_modifier.c ├── 134_ullong_max_and_various_flags_and_1_width_and_5_precision_ll_modifier.c ├── 135_ullong_max_and_various_flags_and_23_width_and_5_precision_ll_modifier.c ├── 136_ullong_max_and_various_flags_combined_ll_modifier.c ├── 137_ullong_max_and_various_flags_combined_and_1_width_ll_modifier.c ├── 138_ullong_max_and_various_flags_combined_and_23_width_ll_modifier.c ├── 139_ullong_max_and_various_flags_combined_and_dot_precision_ll_modifier.c ├── 140_ullong_max_and_various_flags_combined_and_5_precision_ll_modifier.c ├── 141_ullong_max_and_various_flags_combined_and_1_width_and_dot_precision_ll_modifier.c ├── 142_ullong_max_and_various_flags_combined_and_1_width_and_5_precision_ll_modifier.c ├── 143_ullong_max_and_various_flags_combined_and_23_width_and_dot_precision_ll_modifier.c ├── 144_ullong_max_and_various_flags_combined_and_23_width_and_5_precision_ll_modifier.c └── conv_x.h ├── file_paths ├── generator.sh ├── includes ├── ft_printf.h ├── main.h └── tests.h ├── mix ├── 000_launcher.c ├── 001_various_mix_simple.c ├── 002_various_mix_with_flags.c └── mix.h ├── no_type ├── 000_launcher.c ├── 001_empty_string.c ├── 002_newline.c ├── 003_normal_string.c ├── 004_normal_string_with_non_printable.c ├── 005_normal_string_and_newline.c ├── 006_valid_percent_sign.c ├── 007_very_long_string.c └── no_type.h ├── printf ├── 00_launcher.c ├── 01_basic_test.c └── printf.h ├── srcs ├── main.c └── tests.c └── tests.txt /.gitignore: -------------------------------------------------------------------------------- 1 | **.DS_Store 2 | **.a 3 | **.dSYM 4 | **.o 5 | **.so 6 | **~ 7 | main 8 | leaks.txt 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: 2 | - osx 3 | - linux 4 | language: 5 | - c 6 | compiler: 7 | - gcc 8 | script: 9 | - make test 10 | email: 11 | on_success: never 12 | on_failure: never 13 | notifications: 14 | email: false -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ft_printf 2 | 3 | [![Build Status](https://travis-ci.org/hugohow/ft_printf.svg?branch=master)](https://travis-ci.org/hugohow/ft_printf) 4 | 5 | ft_printf("test %-12f et % #.1x %24s !\n", 42.001, 20, "coco"); 6 | 7 | Implementation from scratch of some big int operations. 8 | 9 | Implementation from scratch of the double-precision floating-point format to get the precised representation of 10 | `ft_printf("%+8.14Lf", 12.847e451L);` 11 | 12 | ### No memory leaks. (Valgrind certified) 13 | 14 | ## TO DO 15 | 16 | - Adapt `make test` for linux 17 | 18 | # Usage 19 | 20 | ``` C 21 | #include "ft_printf.h" 22 | 23 | int ft_printf(const char* format, ...); 24 | 25 | int main(void) 26 | { 27 | ft_printf("test %-12f et % #.1x %24s !\n", 42.001, 20, "coco"); 28 | return (0); 29 | } 30 | ``` 31 | 32 | ``` 33 | make re 34 | gcc -Iincludes main.c libftprintf.a -o main 35 | ./main 36 | ``` 37 | 38 | ### Format placeholder syntax 39 | 40 | ``` 41 | %[parameter][flags][width][.precision][length]type 42 | ``` 43 | 44 | #### Flags 45 | 46 | `- + 0 #` 47 | 48 | #### Width 49 | 50 | A minimum number of characters to output. 51 | 52 | #### Precision 53 | 54 | A maximum limit on the output. 55 | 56 | #### Length 57 | 58 | `hh h l ll` 59 | 60 | #### Type 61 | 62 | `% d u f e c o s c p b` 63 | -------------------------------------------------------------------------------- /author: -------------------------------------------------------------------------------- 1 | hhow-cho 2 | -------------------------------------------------------------------------------- /libft/ft_bigint_get_index.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_bigint_get_index.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/05/31 17:31:59 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/05/31 17:34:01 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_bigint_get_index(char *str, char c) 16 | { 17 | int i; 18 | 19 | i = 0; 20 | while (str[i] && str[i] != c) 21 | i++; 22 | return (i); 23 | } 24 | -------------------------------------------------------------------------------- /libft/ft_bigint_shift_right.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_bigint_shift_right.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/05/04 12:53:34 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/06 15:37:30 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_bigint_shift_right(char *str, size_t nb, size_t limit) 16 | { 17 | size_t len; 18 | 19 | len = ft_strlen(str); 20 | if (len == 0 || nb <= 0) 21 | return (str); 22 | len = len + nb; 23 | if (len + 1 > limit) 24 | len = limit - 1; 25 | str[len + 1] = 0; 26 | while (len >= nb) 27 | { 28 | str[len] = str[len - nb]; 29 | len--; 30 | } 31 | while (nb != 0) 32 | { 33 | str[nb - 1] = '0'; 34 | nb--; 35 | } 36 | return (str); 37 | } 38 | -------------------------------------------------------------------------------- /libft/ft_bzero.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_bzero.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 16:44:19 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 17:17:06 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_bzero(void *s, size_t n) 16 | { 17 | ft_memset(s, 0, n); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_isalnum.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isalnum.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/06/02 19:36:00 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/03 11:27:59 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isalnum(int c) 16 | { 17 | return (ft_isalpha(c) || ft_isdigit(c)); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_isalpha.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isalpha.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 16:57:56 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/02 19:36:04 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isalpha(int c) 16 | { 17 | return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_isascii.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isascii.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 16:58:01 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/02 19:36:07 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isascii(int c) 16 | { 17 | return (c >= 0 && c <= 127); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_isdigit.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isdigit.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 16:58:09 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/02 19:36:11 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isdigit(int c) 16 | { 17 | return (c >= '0' && c <= '9'); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_isprint.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_isprint.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 16:59:05 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/02 19:36:14 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_isprint(int c) 16 | { 17 | return (c >= 32 && c <= 126); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_memalloc.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memalloc.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:05:06 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 18:00:46 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memalloc(size_t size) 16 | { 17 | void *mem; 18 | 19 | mem = malloc(size); 20 | if (mem == NULL) 21 | return (NULL); 22 | mem = ft_memset(mem, 0, size); 23 | return (mem); 24 | } 25 | -------------------------------------------------------------------------------- /libft/ft_memccpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memccpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 16:59:11 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:43:58 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memccpy(void *dst, const void *src, int c, size_t n) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | while (i < n) 21 | { 22 | *(unsigned char*)(dst + i) = *(unsigned char*)(src + i); 23 | if (*(unsigned char*)(src + i) == (unsigned char)c) 24 | break ; 25 | i++; 26 | } 27 | if (i == n) 28 | return (NULL); 29 | else 30 | return (dst + i + 1); 31 | } 32 | -------------------------------------------------------------------------------- /libft/ft_memchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:00:01 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:44:22 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memchr(const void *s, int c, size_t n) 16 | { 17 | unsigned char *src; 18 | 19 | src = (unsigned char *)s; 20 | while (n-- > 0) 21 | { 22 | if (*src == (unsigned char)c) 23 | return (void *)src; 24 | src++; 25 | } 26 | return (NULL); 27 | } 28 | -------------------------------------------------------------------------------- /libft/ft_memcmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memcmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:00:08 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:49:51 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_memcmp(const void *s1, const void *s2, size_t n) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | while (i < n) 21 | { 22 | if (*(char *)(s1 + i) != *(char *)(s2 + i)) 23 | break ; 24 | i++; 25 | } 26 | if (i == n) 27 | return (0); 28 | return ((int)(*(unsigned char *)(s1 + i) - *(unsigned char *)(s2 + i))); 29 | } 30 | -------------------------------------------------------------------------------- /libft/ft_memcpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memcpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:00:13 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 11:17:18 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memcpy(void *dst, const void *src, size_t n) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | while (i < n) 21 | { 22 | *(unsigned char*)(dst + i) = *(unsigned char*)(src + i); 23 | i++; 24 | } 25 | return (dst); 26 | } 27 | -------------------------------------------------------------------------------- /libft/ft_memdel.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memdel.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:05:14 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:44:44 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_memdel(void **ap) 16 | { 17 | if (ap == NULL) 18 | return ; 19 | free(*ap); 20 | *ap = NULL; 21 | } 22 | -------------------------------------------------------------------------------- /libft/ft_memmove.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memmove.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:00:20 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/13 13:07:09 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memmove(void *dst, const void *src, size_t len) 16 | { 17 | int i; 18 | 19 | if (dst == src || len == 0) 20 | return (dst); 21 | i = dst > src ? (int)len - 1 : -1; 22 | if (dst > src) 23 | { 24 | while (i + 1 >= 1) 25 | { 26 | *((unsigned char *)(dst + i)) = *((unsigned char *)(src + i)); 27 | i--; 28 | } 29 | } 30 | else 31 | { 32 | while (++i < (int)len) 33 | *((unsigned char *)(dst + i)) = *((unsigned char *)(src + i)); 34 | } 35 | return (dst); 36 | } 37 | -------------------------------------------------------------------------------- /libft/ft_memset.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_memset.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:00:31 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:49:37 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void *ft_memset(void *b, int c, size_t len) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | while (i < len) 21 | { 22 | *(unsigned char*)(b + i) = (unsigned char)c; 23 | i++; 24 | } 25 | return (b); 26 | } 27 | -------------------------------------------------------------------------------- /libft/ft_putchar.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putchar.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:05:29 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 18:01:58 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putchar(char c) 16 | { 17 | write(1, &c, 1); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_putchar_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putchar_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:05:21 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 18:01:48 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putchar_fd(char c, int fd) 16 | { 17 | write(fd, &c, 1); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_putendl.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putendl.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:05:42 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 18:02:21 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putendl(char const *str) 16 | { 17 | if (str == NULL) 18 | return ; 19 | ft_putstr(str); 20 | ft_putstr("\n"); 21 | } 22 | -------------------------------------------------------------------------------- /libft/ft_putendl_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putendl_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:05:37 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:49:27 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putendl_fd(char const *str, int fd) 16 | { 17 | if (str == NULL) 18 | return ; 19 | ft_putstr_fd(str, fd); 20 | ft_putstr_fd("\n", fd); 21 | } 22 | -------------------------------------------------------------------------------- /libft/ft_putnbr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putnbr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:05:53 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 18:04:46 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putnbr(int nb) 16 | { 17 | if (nb == -2147483648) 18 | { 19 | ft_putstr("-2147483648"); 20 | return ; 21 | } 22 | if (nb < 0) 23 | { 24 | nb = -nb; 25 | ft_putstr("-"); 26 | } 27 | if (nb < 10) 28 | ft_putchar(nb + '0'); 29 | else 30 | { 31 | ft_putnbr(nb / 10); 32 | ft_putchar(nb % 10 + '0'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /libft/ft_putnbr_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putnbr_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:05:48 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 18:03:55 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putnbr_fd(int nb, int fd) 16 | { 17 | if (nb == -2147483648) 18 | { 19 | ft_putstr_fd("-2147483648", fd); 20 | return ; 21 | } 22 | if (nb < 0) 23 | { 24 | nb = -nb; 25 | ft_putstr_fd("-", fd); 26 | } 27 | if (nb < 10) 28 | ft_putchar_fd(nb + '0', fd); 29 | else 30 | { 31 | ft_putnbr_fd(nb / 10, fd); 32 | ft_putchar_fd(nb % 10 + '0', fd); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /libft/ft_putstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:06:10 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:49:19 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putstr(char const *str) 16 | { 17 | if (str == NULL) 18 | return ; 19 | write(1, str, ft_strlen(str)); 20 | } 21 | -------------------------------------------------------------------------------- /libft/ft_putstr_fd.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_putstr_fd.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:05:59 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 18:05:06 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_putstr_fd(char const *str, int fd) 16 | { 17 | if (str == NULL) 18 | return ; 19 | write(fd, str, ft_strlen(str)); 20 | } 21 | -------------------------------------------------------------------------------- /libft/ft_str_insert.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_str_insert.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/23 20:35:47 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/13 13:07:26 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | ** ft_str_insert("abc", ' ', 0) = " abc" 17 | */ 18 | 19 | char *ft_str_insert(char *str, char c, int index) 20 | { 21 | char *tmp; 22 | char *output; 23 | 24 | if (str == NULL) 25 | return (NULL); 26 | tmp = (char *)ft_memalloc((index + 2) * sizeof(*tmp)); 27 | if (tmp == NULL) 28 | return (NULL); 29 | ft_strncpy(tmp, str, index); 30 | tmp[index] = c; 31 | tmp[index + 1] = '\0'; 32 | output = ft_strjoin(tmp, str + index); 33 | free(tmp); 34 | tmp = NULL; 35 | free(str); 36 | str = NULL; 37 | return (output); 38 | } 39 | -------------------------------------------------------------------------------- /libft/ft_str_left_shift.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_str_left_shift.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/23 20:29:25 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/29 14:32:29 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | ** "abc" << = "bc " 17 | */ 18 | 19 | char *ft_str_left_shift(char *str, int index_until) 20 | { 21 | int j; 22 | 23 | j = 0; 24 | if (index_until < 0) 25 | { 26 | return (str); 27 | } 28 | if (index_until == 0) 29 | { 30 | str[0] = ' '; 31 | return (str); 32 | } 33 | if (index_until == 1) 34 | { 35 | str[0] = str[1]; 36 | str[1] = ' '; 37 | return (str); 38 | } 39 | while (j < index_until - 1) 40 | { 41 | str[j] = str[j + 1]; 42 | j++; 43 | } 44 | str[j] = ' '; 45 | return (str); 46 | } 47 | -------------------------------------------------------------------------------- /libft/ft_str_right_shift.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_str_right_shift.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/23 20:30:29 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/23 20:35:28 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | /* 16 | ** >> "abc" = " ab" 17 | */ 18 | 19 | char *ft_str_right_shift(char *str, int len) 20 | { 21 | int j; 22 | 23 | j = len; 24 | while (j > 0) 25 | { 26 | str[j] = str[j - 1]; 27 | j--; 28 | } 29 | str[0] = ' '; 30 | return (str); 31 | } 32 | -------------------------------------------------------------------------------- /libft/ft_strcat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strcat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:00:35 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/10 20:29:35 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strcat(char *s1, const char *s2) 16 | { 17 | size_t i; 18 | size_t len1; 19 | 20 | len1 = ft_strlen(s1); 21 | i = 0; 22 | while (s2[i]) 23 | { 24 | s1[len1 + i] = s2[i]; 25 | i++; 26 | } 27 | s1[len1 + i] = '\0'; 28 | return (s1); 29 | } 30 | -------------------------------------------------------------------------------- /libft/ft_strcat_r.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strcat_r.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/23 15:56:50 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/05/05 13:02:04 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strcat_r(const char *src, char *dst) 16 | { 17 | char *tmp; 18 | 19 | tmp = ft_strdup(dst); 20 | if (tmp == NULL) 21 | return (NULL); 22 | ft_strcpy(dst, src); 23 | ft_strcat(dst, tmp); 24 | ft_memdel((void **)&tmp); 25 | return (dst); 26 | } 27 | -------------------------------------------------------------------------------- /libft/ft_strchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:00:44 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 17:37:59 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strchr(const char *s, int c) 16 | { 17 | size_t i; 18 | 19 | if ((char)c == '\0') 20 | return (char *)(s + ft_strlen(s)); 21 | i = 0; 22 | while (*(s + i)) 23 | { 24 | if (*(s + i) == (char)c) 25 | return (char *)(s + i); 26 | i++; 27 | } 28 | return (NULL); 29 | } 30 | -------------------------------------------------------------------------------- /libft/ft_strclr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strclr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:06:16 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/10 20:30:02 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_strclr(char *s) 16 | { 17 | if (s == NULL) 18 | return ; 19 | while (*s) 20 | *s++ = '\0'; 21 | } 22 | -------------------------------------------------------------------------------- /libft/ft_strcmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strcmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:00:53 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 17:38:38 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_strcmp(const char *s1, const char *s2) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | while (*(s1 + i) && *(s2 + i) && *(s1 + i) == *(s2 + i)) 21 | i++; 22 | if (*(s1 + i) == '\0' && *(s2 + i) == '\0') 23 | return (0); 24 | return ((int)((unsigned char)*(s1 + i) - (unsigned char)*(s2 + i))); 25 | } 26 | -------------------------------------------------------------------------------- /libft/ft_strcpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strcpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:01:08 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 17:39:14 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strcpy(char *dst, const char *src) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | while (src[i]) 21 | { 22 | dst[i] = src[i]; 23 | i++; 24 | } 25 | dst[i] = '\0'; 26 | return (dst); 27 | } 28 | -------------------------------------------------------------------------------- /libft/ft_strdel.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strdel.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:06:20 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 18:05:39 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_strdel(char **as) 16 | { 17 | ft_memdel((void **)as); 18 | } 19 | -------------------------------------------------------------------------------- /libft/ft_strdup.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strdup.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:01:15 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/05/31 23:41:35 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strdup(const char *s1) 16 | { 17 | char *copy; 18 | 19 | if (!(copy = (char *)malloc((ft_strlen((char *)s1) + 1) * sizeof(*copy)))) 20 | return (NULL); 21 | copy = ft_strcpy(copy, s1); 22 | return (copy); 23 | } 24 | -------------------------------------------------------------------------------- /libft/ft_strequ.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strequ.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:06:25 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 18:06:02 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_strequ(char const *s1, char const *s2) 16 | { 17 | if (s1 == NULL || s2 == NULL) 18 | return (0); 19 | while (*s1 && *s2 && *s1 == *s2) 20 | { 21 | s1++; 22 | s2++; 23 | } 24 | if (*s1 == '\0' && *s2 == '\0') 25 | return (1); 26 | return (0); 27 | } 28 | -------------------------------------------------------------------------------- /libft/ft_striter.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_striter.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:06:30 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/07 13:52:47 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_striter(char *s, void (*f)(char *)) 16 | { 17 | if (s == NULL || f == NULL) 18 | return ; 19 | while (*s) 20 | { 21 | f(s); 22 | s++; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libft/ft_striteri.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_striteri.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:12:03 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:49:12 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | void ft_striteri(char *s, void (*f)(unsigned int, char *)) 16 | { 17 | unsigned int i; 18 | 19 | if (s == NULL || f == NULL) 20 | return ; 21 | i = 0; 22 | while (s[i]) 23 | { 24 | f(i, &s[i]); 25 | i++; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libft/ft_strjoin.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strjoin.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:12:13 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:49:00 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strjoin(char const *str1, char const *str2) 16 | { 17 | char *new_str; 18 | size_t len; 19 | size_t i; 20 | size_t j; 21 | 22 | if (str1 == NULL || str2 == NULL) 23 | return (NULL); 24 | len = ft_strlen(str1) + ft_strlen(str2) + 1; 25 | if (!(new_str = (char *)malloc(len * sizeof(*new_str)))) 26 | return (NULL); 27 | i = -1; 28 | while (str1[++i]) 29 | new_str[i] = str1[i]; 30 | j = -1; 31 | while (str2[++j]) 32 | new_str[i++] = str2[j]; 33 | new_str[i] = '\0'; 34 | return (new_str); 35 | } 36 | -------------------------------------------------------------------------------- /libft/ft_strlcat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlcat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:01:22 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 17:45:19 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_strlcat(char *dst, const char *src, size_t size) 16 | { 17 | size_t i; 18 | size_t j; 19 | size_t src_len; 20 | size_t dst_len; 21 | 22 | i = 0; 23 | src_len = ft_strlen(src); 24 | while (i < size && dst[i] != '\0') 25 | i++; 26 | dst_len = i; 27 | if (i == size) 28 | { 29 | dst_len = size; 30 | return (dst_len + src_len); 31 | } 32 | j = 0; 33 | while (src[j] && i < size - 1) 34 | dst[i++] = src[j++]; 35 | dst[i] = '\0'; 36 | return (dst_len + src_len); 37 | } 38 | -------------------------------------------------------------------------------- /libft/ft_strlen.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strlen.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:04:02 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/10 20:30:15 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_strlen(const char *str) 16 | { 17 | size_t length; 18 | 19 | length = 0; 20 | while (str[length]) 21 | length++; 22 | return (length); 23 | } 24 | -------------------------------------------------------------------------------- /libft/ft_strmap.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strmap.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:12:23 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:48:13 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strmap(char const *str, char (*f)(char)) 16 | { 17 | char *new_str; 18 | size_t i; 19 | 20 | if (str == NULL) 21 | return (NULL); 22 | if (!(new_str = (char *)malloc((ft_strlen(str) + 1) * sizeof(*new_str)))) 23 | return (NULL); 24 | i = -1; 25 | while (str[++i]) 26 | new_str[i] = (*f)(str[i]); 27 | new_str[i] = '\0'; 28 | return (new_str); 29 | } 30 | -------------------------------------------------------------------------------- /libft/ft_strmapi.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strmapi.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:12:30 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:48:31 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strmapi(char const *str, char (*f)(unsigned int, char)) 16 | { 17 | char *new_str; 18 | unsigned int i; 19 | 20 | if (str == NULL) 21 | return (NULL); 22 | if (!(new_str = (char *)malloc((ft_strlen(str) + 1) * sizeof(*new_str)))) 23 | return (NULL); 24 | i = -1; 25 | while (str[++i]) 26 | new_str[i] = (*f)(i, str[i]); 27 | new_str[i] = '\0'; 28 | return (new_str); 29 | } 30 | -------------------------------------------------------------------------------- /libft/ft_strncat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strncat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:04:08 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/10 20:30:22 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strncat(char *s1, const char *s2, size_t n) 16 | { 17 | size_t i; 18 | size_t len1; 19 | 20 | len1 = ft_strlen(s1); 21 | i = 0; 22 | while (s2[i] && i < n) 23 | { 24 | s1[len1 + i] = s2[i]; 25 | i++; 26 | } 27 | s1[len1 + i] = '\0'; 28 | return (s1); 29 | } 30 | -------------------------------------------------------------------------------- /libft/ft_strncmp.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strncmp.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:04:15 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 17:46:47 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_strncmp(const char *s1, const char *s2, size_t n) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | while (*(s1 + i) && *(s2 + i) && *(s1 + i) == *(s2 + i) && i < n) 21 | i++; 22 | if (i == n) 23 | return (0); 24 | if (*(s1 + i) == '\0' && *(s2 + i) == '\0') 25 | return (0); 26 | return ((int)((unsigned char)*(s1 + i) - (unsigned char)*(s2 + i))); 27 | } 28 | -------------------------------------------------------------------------------- /libft/ft_strncpy.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strncpy.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:04:19 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 17:48:00 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strncpy(char *dst, const char *src, size_t len) 16 | { 17 | size_t i; 18 | 19 | i = 0; 20 | while (src[i] && i < len) 21 | { 22 | dst[i] = src[i]; 23 | i++; 24 | } 25 | if (i == len) 26 | return (dst); 27 | while (i < len) 28 | { 29 | dst[i] = 0; 30 | i++; 31 | } 32 | return (dst); 33 | } 34 | -------------------------------------------------------------------------------- /libft/ft_strnequ.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strnequ.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:12:36 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:48:45 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_strnequ(char const *s1, char const *s2, size_t n) 16 | { 17 | size_t i; 18 | 19 | if (s1 == NULL || s2 == NULL) 20 | return (0); 21 | i = 0; 22 | while (*s1 && *s2 && *s1 == *s2 && i < n) 23 | { 24 | s1++; 25 | s2++; 26 | i++; 27 | } 28 | if (i == n) 29 | return (1); 30 | if (*s1 == '\0' && *s2 == '\0') 31 | return (1); 32 | return (0); 33 | } 34 | -------------------------------------------------------------------------------- /libft/ft_strnew.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strnew.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:12:42 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 18:14:07 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strnew(size_t size) 16 | { 17 | char *str; 18 | 19 | str = (char *)ft_memalloc(size + 1); 20 | return (str); 21 | } 22 | -------------------------------------------------------------------------------- /libft/ft_strnstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strnstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:04:27 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 17:49:53 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strnstr(const char *str, const char *to_find, size_t len) 16 | { 17 | size_t to_find_len; 18 | size_t i; 19 | size_t j; 20 | 21 | to_find_len = ft_strlen(to_find); 22 | if (to_find_len == 0) 23 | return (char *)(str); 24 | i = -1; 25 | while (str[++i] && i < len) 26 | { 27 | if (str[i] == to_find[0]) 28 | { 29 | j = 0; 30 | while (str[i + j] && to_find[j] && 31 | str[i + j] == to_find[j] && i + j < len) 32 | j++; 33 | if (to_find[j] == '\0') 34 | return (char *)(str + i); 35 | } 36 | } 37 | return (NULL); 38 | } 39 | -------------------------------------------------------------------------------- /libft/ft_strrchr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strrchr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:04:33 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:48:01 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strrchr(const char *s, int c) 16 | { 17 | size_t i; 18 | 19 | if ((char)c == '\0') 20 | return (char *)(s + ft_strlen(s)); 21 | if (ft_strlen(s) == 0) 22 | return (NULL); 23 | i = ft_strlen(s) - 1; 24 | while (i > 0) 25 | { 26 | if (*(s + i) == (char)c) 27 | return (char *)(s + i); 28 | i--; 29 | } 30 | if (*s == (char)c) 31 | return (char *)s; 32 | return (NULL); 33 | } 34 | -------------------------------------------------------------------------------- /libft/ft_strstr.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strstr.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:04:38 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:47:44 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strstr(const char *str, const char *to_find) 16 | { 17 | size_t to_find_len; 18 | size_t i; 19 | size_t j; 20 | 21 | to_find_len = ft_strlen(to_find); 22 | if (to_find_len == 0) 23 | return (char *)(str); 24 | i = -1; 25 | while (str[++i]) 26 | { 27 | if (str[i] == to_find[0]) 28 | { 29 | j = 0; 30 | while (str[i + j] && to_find[j] && 31 | str[i + j] == to_find[j]) 32 | j++; 33 | if (to_find[j] == '\0') 34 | return (char *)(str + i); 35 | } 36 | } 37 | return (NULL); 38 | } 39 | -------------------------------------------------------------------------------- /libft/ft_strsub.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strsub.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:12:56 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/11 10:46:26 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | char *ft_strsub(char const *str, unsigned int start, size_t len) 16 | { 17 | char *new_str; 18 | size_t i; 19 | 20 | if (str == NULL) 21 | return (NULL); 22 | if (len + start > ft_strlen(str)) 23 | return (NULL); 24 | if (!(new_str = malloc((len + 1) * sizeof(*new_str)))) 25 | return (NULL); 26 | i = start; 27 | while (i - start != len) 28 | { 29 | new_str[i - start] = str[i]; 30 | i++; 31 | } 32 | new_str[len] = '\0'; 33 | return (new_str); 34 | } 35 | -------------------------------------------------------------------------------- /libft/ft_tolower.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_tolower.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:04:43 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 17:53:23 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_tolower(int c) 16 | { 17 | if (c >= 'A' && c <= 'Z') 18 | return (c - 'A' + 'a'); 19 | return (c); 20 | } 21 | -------------------------------------------------------------------------------- /libft/ft_toupper.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_toupper.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/02 17:04:48 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/02 17:53:49 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_toupper(int c) 16 | { 17 | if (c >= 'a' && c <= 'z') 18 | return (c - 'a' + 'A'); 19 | return (c); 20 | } 21 | -------------------------------------------------------------------------------- /libft/ft_wcslen.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_wcslen.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/12 13:30:59 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/12 13:32:56 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | size_t ft_wcslen(const wchar_t *str) 16 | { 17 | size_t len; 18 | 19 | len = 0; 20 | while (str[len]) 21 | len++; 22 | return (len); 23 | } 24 | -------------------------------------------------------------------------------- /srcs/ft_print_arg/ft_print_percent.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_print_percent.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/25 20:05:59 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/07 15:31:01 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | char *ft_print_percent(va_list *ap, t_flag *flag) 16 | { 17 | char *output; 18 | 19 | (void)ap; 20 | (void)flag; 21 | output = ft_strdup_alloc(PERCENTAGE, ft_len_to_alloc(1, flag)); 22 | if (flag->precision != 0) 23 | output = ft_apply_precision_str(output, flag, 1); 24 | output = ft_apply_padding_str(output, flag, 1); 25 | return (output); 26 | } 27 | -------------------------------------------------------------------------------- /srcs/ft_print_arg/ft_print_s.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_print_s.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/25 20:24:51 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/05 15:05:06 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | char *ft_print_s(va_list *ap, t_flag *flag) 16 | { 17 | char *output; 18 | char *arg; 19 | size_t size_allocation; 20 | 21 | arg = va_arg(*ap, char*); 22 | size_allocation = arg == NULL ? ft_strlen("(null)") : ft_strlen(arg); 23 | size_allocation = ft_len_to_alloc(size_allocation, flag); 24 | if (!(output = (char *)ft_memalloc(sizeof(char) * size_allocation))) 25 | return (NULL); 26 | output = ft_strcpy(output, arg == NULL ? "(null)" : arg); 27 | output = ft_apply_precision_str(output, flag, 1); 28 | output = ft_apply_padding_str(output, flag, 1); 29 | return (output); 30 | } 31 | -------------------------------------------------------------------------------- /srcs/helpers/ft_condition_fill.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_condition_fill.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/06/01 22:52:12 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/03 12:17:55 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | int ft_can_fill_to_the_left(t_flag *flag, int sign) 16 | { 17 | (void)sign; 18 | return (flag->zero == 1 && flag->minus == 0); 19 | } 20 | 21 | int ft_can_fill_to_the_right(t_flag *flag, int sign) 22 | { 23 | return (!ft_can_fill_to_the_left(flag, sign)); 24 | } 25 | 26 | int ft_can_fill_with_zeros(t_flag *flag, int sign) 27 | { 28 | return (ft_can_fill_to_the_left(flag, sign) && flag->precision == -1); 29 | } 30 | 31 | int ft_can_fill_with_zeros_float(t_flag *flag, int sign) 32 | { 33 | return (ft_can_fill_to_the_left(flag, sign)); 34 | } 35 | -------------------------------------------------------------------------------- /srcs/helpers/ft_flaglen.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_flaglen.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/12 19:39:58 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/07 15:00:02 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | static int is_valid_par(char c) 16 | { 17 | if (c == ' ' || c == '#' || c == '0' || c == '-' || c == '+' || c == '*' \ 18 | || c == '$' || c == '.') 19 | return (1); 20 | if (ft_isdigit(c) == 1) 21 | return (1); 22 | if (c == 'h' || c == 'l' || c == 'j' || c == 'z' || c == 'L' || c == 't') 23 | return (1); 24 | return (0); 25 | } 26 | 27 | size_t ft_flaglen(const char *str) 28 | { 29 | size_t i; 30 | 31 | i = 1; 32 | while (str[i] && is_valid_par(str[i]) == 1) 33 | { 34 | if (str[i] == '%') 35 | break ; 36 | i++; 37 | } 38 | return (i); 39 | } 40 | -------------------------------------------------------------------------------- /srcs/helpers/ft_format_is_valid.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_format_is_valid.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/06/04 20:41:29 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/07 12:24:44 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | int ft_format_is_valid(const char *fo) 16 | { 17 | int i; 18 | int ret; 19 | 20 | i = -1; 21 | while (fo[++i]) 22 | { 23 | if (fo[i] == '%') 24 | { 25 | ret = (int)ft_flaglen(fo + i); 26 | if (ret == -1) 27 | return (0); 28 | i += ret; 29 | } 30 | } 31 | return (1); 32 | } 33 | -------------------------------------------------------------------------------- /srcs/helpers/ft_get_binary.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_get_binary.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/05/31 22:57:04 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/03 12:15:55 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | char *ft_get_binary(unsigned char c, char *tmp_str) 16 | { 17 | char base[3]; 18 | char tmp; 19 | int k; 20 | 21 | ft_strcpy(base, "01"); 22 | k = 0; 23 | while (c != 0) 24 | { 25 | tmp_str[k++] = base[c % 2]; 26 | c /= 2; 27 | } 28 | while (k != 8) 29 | tmp_str[k++] = base[0]; 30 | tmp_str[k] = '\0'; 31 | k = 0; 32 | while (k != 4) 33 | { 34 | tmp = tmp_str[k]; 35 | tmp_str[k] = tmp_str[7 - k]; 36 | tmp_str[7 - k] = tmp; 37 | k++; 38 | } 39 | return (tmp_str); 40 | } 41 | -------------------------------------------------------------------------------- /srcs/helpers/ft_nblen_ull.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_nblen_ull.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/25 19:07:31 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/25 19:08:00 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | size_t ft_nblen_ull(unsigned long long nb) 16 | { 17 | size_t nblen; 18 | 19 | nblen = 0; 20 | if (nb == 0) 21 | return (1); 22 | while (nb != 0) 23 | { 24 | nb /= 10; 25 | nblen++; 26 | } 27 | return (nblen); 28 | } 29 | -------------------------------------------------------------------------------- /srcs/helpers/ft_print_null.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_print_null.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/06/02 13:17:12 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/07 12:03:06 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | int ft_print_null(char *output, t_flag *flag, int fd) 16 | { 17 | char c; 18 | int i; 19 | 20 | i = 0; 21 | c = 0; 22 | while (i < flag->character_i) 23 | { 24 | ft_putchar_fd(output[i], fd); 25 | i++; 26 | } 27 | write(1, &c, fd); 28 | i++; 29 | while (output[i]) 30 | { 31 | ft_putchar_fd(output[i], fd); 32 | i++; 33 | } 34 | return (i); 35 | } 36 | -------------------------------------------------------------------------------- /srcs/helpers/ft_size_to_allocate.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_size_to_allocate.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/25 18:55:17 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/03 11:18:42 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | static int max(int a, int b, int c) 16 | { 17 | int result; 18 | 19 | result = a; 20 | if (b > result) 21 | result = b; 22 | if (c > result) 23 | result = c; 24 | return (result); 25 | } 26 | 27 | int ft_len_to_alloc(size_t original_nblen, t_flag *flag) 28 | { 29 | return (max((int)(original_nblen + 10), (int)(flag->width + 10), \ 30 | (int)(flag->precision + 10))); 31 | } 32 | -------------------------------------------------------------------------------- /srcs/helpers/ft_str_join.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_str_join.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/05/31 00:12:18 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/03 11:18:45 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | char *ft_str_join(const char *to_add, char *str1, t_flag *flag) 16 | { 17 | char *output; 18 | size_t size_allocation; 19 | int k; 20 | int i; 21 | 22 | size_allocation = ft_len_to_alloc(\ 23 | ft_strlen(str1) + ft_strlen(to_add), flag); 24 | if (!(output = (char *)ft_memalloc(sizeof(char) * (size_allocation + 1)))) 25 | return (NULL); 26 | k = 0; 27 | i = 0; 28 | while (to_add[i]) 29 | output[k++] = to_add[i++]; 30 | i = 0; 31 | while (str1[i]) 32 | output[k++] = str1[i++]; 33 | output[k] = 0; 34 | ft_memdel((void **)&str1); 35 | return (output); 36 | } 37 | -------------------------------------------------------------------------------- /srcs/helpers/ft_str_join_r.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_str_join_r.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/05/31 00:12:40 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/03 11:18:48 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | char *ft_str_join_r(char *str1, const char *to_add, t_flag *flag) 16 | { 17 | char *output; 18 | size_t size_allocation; 19 | int k; 20 | int i; 21 | 22 | size_allocation = ft_len_to_alloc(\ 23 | ft_strlen(str1) + ft_strlen(to_add), flag); 24 | if (!(output = (char *)ft_memalloc(sizeof(char) * (size_allocation + 1)))) 25 | return (NULL); 26 | k = 0; 27 | i = 0; 28 | while (str1[i]) 29 | output[k++] = str1[i++]; 30 | i = 0; 31 | while (to_add[i]) 32 | output[k++] = to_add[i++]; 33 | output[k] = 0; 34 | ft_memdel((void **)&str1); 35 | return (output); 36 | } 37 | -------------------------------------------------------------------------------- /srcs/helpers/ft_str_precision_count.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_str_precision_count.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/25 12:13:21 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/25 14:27:28 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "libft.h" 14 | 15 | int ft_str_precision_count(char *str, int offset) 16 | { 17 | int count; 18 | int i; 19 | 20 | i = offset; 21 | count = 0; 22 | while (str[i]) 23 | { 24 | if (ft_isdigit(str[i]) || ft_isalpha(str[i])) 25 | { 26 | while (str[i] && (ft_isdigit(str[i]) || ft_isalpha(str[i]))) 27 | { 28 | count++; 29 | i++; 30 | } 31 | if (str[i] == '\0') 32 | break ; 33 | } 34 | i++; 35 | } 36 | return (count); 37 | } 38 | -------------------------------------------------------------------------------- /srcs/helpers/ft_strcat_char.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strcat_char.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/06/02 13:58:17 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/02 13:59:18 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | char *ft_strcat_char(char *s1, const char c) 16 | { 17 | size_t len1; 18 | 19 | len1 = ft_strlen(s1); 20 | s1[len1] = c; 21 | s1[len1 + 1] = '\0'; 22 | return (s1); 23 | } 24 | -------------------------------------------------------------------------------- /srcs/helpers/ft_strdup_alloc.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strdup_alloc.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/06/02 11:19:46 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/02 11:20:27 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | char *ft_strdup_alloc(const char *s1, size_t size_allocation) 16 | { 17 | char *copy; 18 | 19 | if (!(copy = (char *)malloc((size_allocation) * sizeof(char)))) 20 | return (NULL); 21 | copy = ft_strcpy(copy, s1); 22 | return (copy); 23 | } 24 | -------------------------------------------------------------------------------- /srcs/helpers/ft_ulltoa_offset.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_ulltoa_offset.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/25 19:07:35 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/06 13:30:08 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | char *ft_ulltoa_offset(unsigned long long nb, size_t size_allocation) 16 | { 17 | char *output; 18 | size_t nb_len; 19 | 20 | nb_len = ft_nblen_ull(nb); 21 | if (!(output = (char *)ft_memalloc(sizeof(char) * size_allocation))) 22 | return (NULL); 23 | output[0] = '0'; 24 | output[nb_len] = '\0'; 25 | while (nb != 0) 26 | { 27 | output[--nb_len] = (nb % 10) + '0'; 28 | nb /= 10; 29 | } 30 | return (output); 31 | } 32 | -------------------------------------------------------------------------------- /srcs/parser/ft_flag_create_space.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_flag_create_space.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/12 15:36:38 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/12 15:36:53 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | int ft_flag_get_space(char *flag) 16 | { 17 | unsigned int i; 18 | 19 | i = 0; 20 | if (flag[ft_strlen(flag) - 1] == '%') 21 | return (0); 22 | while (flag[i] && ft_isdigit(flag[i]) == 0) 23 | { 24 | if (flag[i] == ' ') 25 | return (1); 26 | i++; 27 | } 28 | return (0); 29 | } 30 | -------------------------------------------------------------------------------- /srcs/parser/ft_flag_get_hash.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_flag_get_hash.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/12 15:34:50 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/12 15:35:03 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | int ft_flag_get_hash(char *flag) 16 | { 17 | unsigned int i; 18 | 19 | i = 0; 20 | if (flag[ft_strlen(flag) - 1] == '%') 21 | return (0); 22 | while ((flag[i] && ft_isdigit(flag[i]) == 0) || flag[i] == '0') 23 | { 24 | if (flag[i] == '#') 25 | return (1); 26 | i++; 27 | } 28 | return (0); 29 | } 30 | -------------------------------------------------------------------------------- /srcs/parser/ft_flag_get_minus.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_flag_get_minus.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/12 15:37:28 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/05 22:45:46 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | int ft_flag_get_minus(char *flag) 16 | { 17 | unsigned int i; 18 | 19 | i = 0; 20 | while (flag[i]) 21 | { 22 | if (flag[i] == '-') 23 | return (1); 24 | i++; 25 | } 26 | return (0); 27 | } 28 | -------------------------------------------------------------------------------- /srcs/parser/ft_flag_get_plus.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_flag_get_plus.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/12 15:38:02 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/04/12 15:38:09 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | int ft_flag_get_plus(char *flag) 16 | { 17 | unsigned int i; 18 | 19 | i = 0; 20 | if (flag[ft_strlen(flag) - 1] == '%') 21 | return (0); 22 | while (flag[i] && (ft_isdigit(flag[i]) == 0 || flag[i] == '0')) 23 | { 24 | if (flag[i] == '+') 25 | return (1); 26 | i++; 27 | } 28 | return (0); 29 | } 30 | -------------------------------------------------------------------------------- /srcs/parser/ft_flag_get_zero.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_flag_get_zero.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/12 15:39:10 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/10 20:29:33 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | int ft_flag_get_zero(char *str) 16 | { 17 | unsigned int i; 18 | 19 | i = 0; 20 | while (str[i]) 21 | { 22 | if (str[i] == '.') 23 | break ; 24 | if (ft_isdigit(str[i])) 25 | { 26 | if (str[i] == '0') 27 | return (1); 28 | break ; 29 | } 30 | i++; 31 | } 32 | return (0); 33 | } 34 | -------------------------------------------------------------------------------- /srcs/precision/ft_apply_precision_nb.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_apply_precision_nb.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/04/12 17:11:14 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/05/30 22:18:19 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | char *ft_apply_precision_nb(char *str, t_flag *flag, int sign) 16 | { 17 | unsigned int str_len; 18 | 19 | str_len = ft_strlen(str); 20 | if (sign == 0 && flag->precision == 0) 21 | { 22 | str = ft_strcpy(str, ""); 23 | return (str); 24 | } 25 | if (flag->precision < 0) 26 | return (str); 27 | if (str_len == (unsigned int)flag->precision) 28 | return (str); 29 | if (ft_str_precision_count(str, 0) < flag->precision) 30 | return (ft_add_char(str, flag, '0')); 31 | return (str); 32 | } 33 | -------------------------------------------------------------------------------- /srcs/precision/ft_apply_precision_str.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_apply_precision_str.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: hhow-cho +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/05/30 22:01:56 by hhow-cho #+# #+# */ 9 | /* Updated: 2019/06/13 13:06:43 by hhow-cho ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include "ft_printf.h" 14 | 15 | char *ft_apply_precision_str(char *str, t_flag *flag, int sign) 16 | { 17 | if (sign == 0 && flag->precision == 0) 18 | return (ft_strcpy(str, "")); 19 | if (flag->precision < 0) 20 | return (str); 21 | str[flag->precision] = '\0'; 22 | return (str); 23 | } 24 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | .obj 2 | *.dSYM* 3 | *.sw* 4 | backup 5 | tests/tests 6 | trace.txt 7 | assets 8 | libftprintf.so 9 | libunit.a 10 | -------------------------------------------------------------------------------- /tests/auteur: -------------------------------------------------------------------------------- 1 | jkettani 2 | -------------------------------------------------------------------------------- /tests/framework/includes/frmk_error.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* frmk_error.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jkettani +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/03/22 16:40:03 by jkettani #+# #+# */ 9 | /* Updated: 2019/03/22 16:40:15 by jkettani ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef FRMK_ERROR_H 14 | # define FRMK_ERROR_H 15 | 16 | /* 17 | ** ERROR CODES 18 | ** Error codes in errno.h goes from 1 to 131. 19 | ** So we start at 200 for our own error codes: 20 | ** > ENULL: null pointer in function 21 | ** > EUSIG: undefined signal catched 22 | */ 23 | # define ENULL 200 24 | # define EUSIG 201 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /tests/framework/includes/frmk_stdout_utils.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* frmk_stdout_utils.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jkettani +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/03/22 16:41:51 by jkettani #+# #+# */ 9 | /* Updated: 2019/03/22 16:41:59 by jkettani ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef FRMK_STDOUT_UTILS_H 14 | # define FRMK_STDOUT_UTILS_H 15 | 16 | int get_fd(const char *path, t_output_mode output_mode, 17 | t_open_mode open_mode); 18 | int pipe_stdout(int *pfd, int *save_out); 19 | int reconnect_stdout(int *save_out); 20 | int read_pipe(char **str, int *ret, int *pfd, int *save_out); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /tests/framework/includes/frmk_utils.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* frmk_utils.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jkettani +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/03/22 16:42:07 by jkettani #+# #+# */ 9 | /* Updated: 2019/03/22 16:42:17 by jkettani ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef FRMK_UTILS_H 14 | # define FRMK_UTILS_H 15 | 16 | void *memalloc(size_t size); 17 | void *memcat(void *s1, size_t n1, const void *s2, size_t n2); 18 | void *memjoin(const void *s1, size_t n1, const void *s2, size_t n2); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /tests/images/makefile_libftprintf_path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugohow/ft_printf/66fee8e118dbcf7d16fbd21274bc1be6cd25ef6d/tests/images/makefile_libftprintf_path.png -------------------------------------------------------------------------------- /tests/images/printf_unit_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugohow/ft_printf/66fee8e118dbcf7d16fbd21274bc1be6cd25ef6d/tests/images/printf_unit_test.png -------------------------------------------------------------------------------- /tests/images/trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hugohow/ft_printf/66fee8e118dbcf7d16fbd21274bc1be6cd25ef6d/tests/images/trace.png -------------------------------------------------------------------------------- /tests/templates/000_launcher_template.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "ft_printf.h" 3 | #include "TMPL_FCT_NAME.h" 4 | 5 | /* Load test format: 6 | if ((err = load_test(&test_list, "TMPL_TEST_NAME", 7 | &TMPL_FCT_NAME_TMPL_TEST_FCT_NAME, SUCCESS))) 8 | return (err); 9 | */ 10 | 11 | int TMPL_FCT_NAME_launcher(void) 12 | { 13 | t_unit_test *test_list; 14 | char *fct_name; 15 | int err; 16 | int fd; 17 | int fd_trace; 18 | 19 | fct_name = "TMPL_FCT_NAME"; 20 | err = 0; 21 | fd = TESTS_OUTPUT_FD; 22 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 23 | test_list = NULL; 24 | print_fct_name_fd(fct_name, fd); 25 | if (fd_trace != fd) 26 | print_fct_name_trace_fd(fct_name, fd_trace); 27 | /*LOAD_TEST_HERE*/ 28 | return (launch_tests(&test_list, fd)); 29 | } 30 | -------------------------------------------------------------------------------- /tests/templates/XXX_test_template.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS TMPL_ARGS 12 | 13 | int TMPL_FCT_NAME_TMPL_TEST_FCT_NAME(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/templates/header_template.h: -------------------------------------------------------------------------------- 1 | #ifndef TMPL_FCT_NAME_H 2 | # define TMPL_FCT_NAME_H 3 | 4 | /*PROTOTYPES_HERE*/ 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /tests/templates/main_template.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | # define MAIN_H 3 | 4 | /*PROTOTYPES_HERE*/ 5 | 6 | typedef struct s_launcher 7 | { 8 | char *fct_name; 9 | int (*launcher)(void); 10 | } t_launcher; 11 | 12 | t_launcher g_launchtab[] = 13 | { 14 | /*FCTS_HERE*/ 15 | {"", NULL} 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /tests/tests/conv_c/001_char_null.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%c|%-c|%12c|%-12c", 0, 0, 0, 0 12 | 13 | int conv_c_char_null(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_c/005_short_max.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%c|%-c|%12c|%-12c", 1345, 1345, 1345, 1345 12 | 13 | int conv_c_short_max(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_c/conv_c.h: -------------------------------------------------------------------------------- 1 | #ifndef conv_c_H 2 | # define conv_c_H 3 | 4 | int conv_c_char_null(void); 5 | int conv_c_ascii_chars(void); 6 | int conv_c_ascii_chars_8_width(void); 7 | int conv_c_ascii_chars_8_width_flag(void); 8 | int conv_c_short_max(void); 9 | /*PROTOTYPES_HERE*/ 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /tests/tests/conv_cap_x/001_zero_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%X|%-X|%#X|%0X", 0U, 0U, 0U, 0U 12 | 13 | int conv_cap_x_zero_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_cap_x/002_zero_and_various_flags_and_1_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%1X|%-1X|%#X|%01X", 0U, 0U, 0U, 0U 12 | 13 | int conv_cap_x_zero_and_various_flags_and_1_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_cap_x/003_zero_and_various_flags_and_23_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%23X|%-23X|%#X|%023X", 0U, 0U, 0U, 0U 12 | 13 | int conv_cap_x_zero_and_various_flags_and_23_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_cap_x/010_zero_and_various_flags_combined.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-#X|%-0X|%#0X|%-#0X", 0U, 0U, 0U, 0U 12 | 13 | int conv_cap_x_zero_and_various_flags_combined(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_d/001_zero_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%d|%-d|%+d|% d|%0d", 0, 0, 0, 0, 0 12 | 13 | int conv_d_zero_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_d/002_zero_and_various_flags_and_1_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%1d|%-1d|%+1d|% 1d|%01d", 0, 0, 0, 0, 0 12 | 13 | int conv_d_zero_and_various_flags_and_1_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_d/019_minus_zero_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%d|%-d|%+d|% d|%0d", -0, -0, -0, -0, -0 12 | 13 | int conv_d_minus_zero_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_f/001_zero_double_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%f|%-f|%+f|% f|%#f|%0f", 0., 0., 0., 0., 0., 0. 12 | 13 | int conv_f_zero_double_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_f/046_double_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%f|%-f|%+f|% f|%#f|%0f", 42., 42., 42., 42., 42., 42. 12 | 13 | int conv_f_double_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_f/100_long_double_max.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%Lf", LDBL_MAX 12 | 13 | int conv_f_long_double_max(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_f/101_long_double_min.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%Lf", LDBL_MIN 12 | 13 | int conv_f_long_double_min(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_f/109_rounding_middle_down.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%.f|%.f|%.f|%.f|%.f", 44.5, 44.4, 44.6, 44.50001, 44.5 + 1e-52 12 | 13 | int conv_f_rounding_middle_down(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_f/110_rounding_middle_up.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%.f|%.f|%.f|%.f|%.f", 45.5, 45.4, 45.6, 45.50001, 45.5 + 1e-52 12 | 13 | int conv_f_rounding_middle_up(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_f/111_powers_of_10.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%f|%f|%f|%f|%f", 1.e1, 1.e2, 1.e18, 1.e57, 1.e201 12 | 13 | int conv_f_powers_of_10(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_f/114_errors.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%.2147483649f|%2147483649f", 1.0, 1.0 12 | 13 | int conv_f_errors(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_i/001_zero_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%i|%-i|%+i|% i|%0i", 0, 0, 0, 0, 0 12 | 13 | int conv_i_zero_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_i/002_zero_and_various_flags_and_1_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%1i|%-1i|%+1i|% 1i|%01i", 0, 0, 0, 0, 0 12 | 13 | int conv_i_zero_and_various_flags_and_1_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_i/019_minus_zero_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%i|%-i|%+i|% i|%0i", -0, -0, -0, -0, -0 12 | 13 | int conv_i_minus_zero_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_o/001_zero_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%o|%-o|%#o|%0o", 0U, 0U, 0U, 0U 12 | 13 | int conv_o_zero_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_o/002_zero_and_various_flags_and_1_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%1o|%-1o|%#o|%01o", 0U, 0U, 0U, 0U 12 | 13 | int conv_o_zero_and_various_flags_and_1_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_o/003_zero_and_various_flags_and_23_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%23o|%-23o|%#o|%023o", 0U, 0U, 0U, 0U 12 | 13 | int conv_o_zero_and_various_flags_and_23_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_o/010_zero_and_various_flags_combined.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-#o|%-0o|%#0o|%-#0o", 0U, 0U, 0U, 0U 12 | 13 | int conv_o_zero_and_various_flags_combined(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_o/019_uint_max_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%o|%-o|%#o|%0o", UINT_MAX, UINT_MAX, UINT_MAX, UINT_MAX 12 | 13 | int conv_o_uint_max_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_p/000_launcher.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "ft_printf.h" 3 | #include "conv_p.h" 4 | 5 | /* Load test format: 6 | if ((err = load_test(&test_list, "TMPL_TEST_NAME", 7 | &conv_p_TMPL_TEST_FCT_NAME, SUCCESS))) 8 | return (err); 9 | */ 10 | 11 | int conv_p_launcher(void) 12 | { 13 | t_unit_test *test_list; 14 | char *fct_name; 15 | int err; 16 | int fd; 17 | int fd_trace; 18 | 19 | fct_name = "conv_p"; 20 | err = 0; 21 | fd = TESTS_OUTPUT_FD; 22 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 23 | test_list = NULL; 24 | print_fct_name_fd(fct_name, fd); 25 | if (fd_trace != fd) 26 | print_fct_name_trace_fd(fct_name, fd_trace); 27 | if ((err = load_test(&test_list, "\"%p\", NULL", 28 | &conv_p_null_pointer, SUCCESS))) 29 | return (err); 30 | if ((err = load_test(&test_list, "\"%p\", \"Random string\"", 31 | &conv_p_random_string, SUCCESS))) 32 | return (err); 33 | if ((err = load_test(&test_list, "\"%5p\", \"Random string\"", 34 | &conv_p_random_string_and_5_width, SUCCESS))) 35 | return (err); 36 | if ((err = load_test(&test_list, "\"%30p\", \"Random string\"", 37 | &conv_p_random_string_and_30_width, SUCCESS))) 38 | return (err); 39 | if ((err = load_test(&test_list, "\"%-30p\", \"Random string\"", 40 | &conv_p_random_string_and_minus_flag_and_30_width, SUCCESS))) 41 | return (err); 42 | if ((err = load_test(&test_list, "\"%p\", &printf", 43 | &conv_p_function_pointer, SUCCESS))) 44 | return (err); 45 | /*LOAD_TEST_HERE*/ 46 | return (launch_tests(&test_list, fd)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_p/001_null_pointer.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%p", NULL 12 | 13 | int conv_p_null_pointer(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_p/002_random_string.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%p", "Random string" 12 | 13 | int conv_p_random_string(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_p/003_random_string_and_5_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%5p", "Random string" 12 | 13 | int conv_p_random_string_and_5_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_p/004_random_string_and_30_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%30p", "Random string" 12 | 13 | int conv_p_random_string_and_30_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_p/005_random_string_and_minus_flag_and_30_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-30p", "Random string" 12 | 13 | int conv_p_random_string_and_minus_flag_and_30_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_p/006_function_pointer.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%p", &printf 12 | 13 | int conv_p_function_pointer(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_p/conv_p.h: -------------------------------------------------------------------------------- 1 | #ifndef conv_p_H 2 | # define conv_p_H 3 | 4 | int conv_p_null_pointer(void); 5 | int conv_p_random_string(void); 6 | int conv_p_random_string_and_5_width(void); 7 | int conv_p_random_string_and_30_width(void); 8 | int conv_p_random_string_and_minus_flag_and_30_width(void); 9 | int conv_p_function_pointer(void); 10 | /*PROTOTYPES_HERE*/ 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /tests/tests/conv_s/005_string_format_and_random_string.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "This is a %s", "random string" 12 | 13 | int conv_s_string_format_and_random_string(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_s/008_multiple_random_strings.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%s %s - %s %s", "string1", "string2", "string3", "string4" 12 | 13 | int conv_s_multiple_random_strings(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_s/009_only_string_conv.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%s%s%s%s", "string1", "string2", "string3", "string4" 12 | 13 | int conv_s_only_string_conv(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_s/conv_s.h: -------------------------------------------------------------------------------- 1 | #ifndef conv_s_H 2 | # define conv_s_H 3 | 4 | int conv_s_null_pointer_various_flags(void); 5 | int conv_s_random_string_various_flags(void); 6 | int conv_s_emoticone_various_flags(void); 7 | int conv_s_emoticone_utf8_encoded_various_flags(void); 8 | int conv_s_string_format_and_random_string(void); 9 | int conv_s_string_format_and_random_string_and_width(void); 10 | int conv_s_string_format_and_random_string_and_precision(void); 11 | int conv_s_multiple_random_strings(void); 12 | int conv_s_only_string_conv(void); 13 | int conv_s_very_long_string(void); 14 | /*PROTOTYPES_HERE*/ 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /tests/tests/conv_u/001_zero_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%u|%-u|%0u", 0U, 0U, 0U 12 | 13 | int conv_u_zero_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/002_zero_and_various_flags_and_1_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%1u|%-1u|%01u", 0U, 0U, 0U 12 | 13 | int conv_u_zero_and_various_flags_and_1_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/003_zero_and_various_flags_and_23_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%23u|%-23u|%023u", 0U, 0U, 0U 12 | 13 | int conv_u_zero_and_various_flags_and_23_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/004_zero_and_various_flags_and_dot_precision.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%.u|%-.u|%0.u", 0U, 0U, 0U 12 | 13 | int conv_u_zero_and_various_flags_and_dot_precision(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/005_zero_and_various_flags_and_5_precision.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%.5u|%-.5u|%0.5u", 0U, 0U, 0U 12 | 13 | int conv_u_zero_and_various_flags_and_5_precision(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/010_zero_and_various_flags_combined.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-0u", 0U 12 | 13 | int conv_u_zero_and_various_flags_combined(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/011_zero_and_various_flags_combined_and_1_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-01u", 0U 12 | 13 | int conv_u_zero_and_various_flags_combined_and_1_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/012_zero_and_various_flags_combined_and_23_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-023u", 0U 12 | 13 | int conv_u_zero_and_various_flags_combined_and_23_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/013_zero_and_various_flags_combined_and_dot_precision.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-0.u", 0U 12 | 13 | int conv_u_zero_and_various_flags_combined_and_dot_precision(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/014_zero_and_various_flags_combined_and_5_precision.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-0.5u", 0U 12 | 13 | int conv_u_zero_and_various_flags_combined_and_5_precision(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/019_uint_max_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%u|%-u|%0u", UINT_MAX, UINT_MAX, UINT_MAX 12 | 13 | int conv_u_uint_max_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/028_uint_max_and_various_flags_combined.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-0u", UINT_MAX 12 | 13 | int conv_u_uint_max_and_various_flags_combined(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/029_uint_max_and_various_flags_combined_and_1_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-01u", UINT_MAX 12 | 13 | int conv_u_uint_max_and_various_flags_combined_and_1_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/037_ulong_max_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%u|%-u|%0u", ULONG_MAX, ULONG_MAX, ULONG_MAX 12 | 13 | int conv_u_ulong_max_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/046_ulong_max_and_various_flags_combined.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-0u", ULONG_MAX 12 | 13 | int conv_u_ulong_max_and_various_flags_combined(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/055_ullong_max_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%u|%-u|%0u", ULLONG_MAX, ULLONG_MAX, ULLONG_MAX 12 | 13 | int conv_u_ullong_max_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/064_ullong_max_and_various_flags_combined.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-0u", ULLONG_MAX 12 | 13 | int conv_u_ullong_max_and_various_flags_combined(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_u/091_ullong_max_and_various_flags_h.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%hu|%-hu|%0hu", ULLONG_MAX, ULLONG_MAX, ULLONG_MAX 12 | 13 | int conv_u_ullong_max_and_various_flags_h(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_x/001_zero_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%x|%-x|%#x|%0x", 0U, 0U, 0U, 0U 12 | 13 | int conv_x_zero_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_x/002_zero_and_various_flags_and_1_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%1x|%-1x|%#x|%01x", 0U, 0U, 0U, 0U 12 | 13 | int conv_x_zero_and_various_flags_and_1_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_x/003_zero_and_various_flags_and_23_width.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%23x|%-23x|%#x|%023x", 0U, 0U, 0U, 0U 12 | 13 | int conv_x_zero_and_various_flags_and_23_width(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_x/010_zero_and_various_flags_combined.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%-#x|%-0x|%#0x|%-#0x", 0U, 0U, 0U, 0U 12 | 13 | int conv_x_zero_and_various_flags_combined(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/conv_x/019_uint_max_and_various_flags.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%x|%-x|%#x|%0x", UINT_MAX, UINT_MAX, UINT_MAX, UINT_MAX 12 | 13 | int conv_x_uint_max_and_various_flags(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/includes/ft_printf.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_printf.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jkettani +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/03/21 15:12:32 by jkettani #+# #+# */ 9 | /* Updated: 2019/03/21 15:14:26 by jkettani ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef FT_PRINTF_H 14 | # define FT_PRINTF_H 15 | 16 | # include 17 | 18 | int ft_printf(const char * restrict format, ...); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /tests/tests/includes/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | # define MAIN_H 3 | 4 | int no_type_launcher(void); 5 | int conv_d_launcher(void); 6 | int conv_i_launcher(void); 7 | int conv_u_launcher(void); 8 | int conv_o_launcher(void); 9 | int conv_x_launcher(void); 10 | int conv_cap_x_launcher(void); 11 | int conv_c_launcher(void); 12 | int conv_s_launcher(void); 13 | int conv_p_launcher(void); 14 | int conv_f_launcher(void); 15 | int mix_launcher(void); 16 | /*PROTOTYPES_HERE*/ 17 | 18 | typedef struct s_launcher 19 | { 20 | char *fct_name; 21 | int (*launcher)(void); 22 | } t_launcher; 23 | 24 | t_launcher g_launchtab[] = 25 | { 26 | {"no_type", no_type_launcher}, 27 | {"conv_d", conv_d_launcher}, 28 | {"conv_i", conv_i_launcher}, 29 | {"conv_u", conv_u_launcher}, 30 | {"conv_o", conv_o_launcher}, 31 | {"conv_x", conv_x_launcher}, 32 | {"conv_cap_x", conv_cap_x_launcher}, 33 | {"conv_c", conv_c_launcher}, 34 | {"conv_s", conv_s_launcher}, 35 | {"conv_p", conv_p_launcher}, 36 | {"conv_f", conv_f_launcher}, 37 | {"mix", mix_launcher}, 38 | /*FCTS_HERE*/ 39 | {"", NULL} 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /tests/tests/includes/tests.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* tests.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jkettani +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/03/03 16:27:36 by jkettani #+# #+# */ 9 | /* Updated: 2019/03/04 19:13:52 by jkettani ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef TESTS_H 14 | # define TESTS_H 15 | 16 | typedef struct s_test_rslt{ 17 | char *user_str; 18 | char *ref_str; 19 | int user_ret; 20 | int ref_ret; 21 | } t_test_rslt; 22 | 23 | void print_header_fd(int fd); 24 | void print_test_result_values_trace(t_test_rslt *test_rslt, 25 | int fd_trace); 26 | int free_result(t_test_rslt *test_rslt, int ret_value); 27 | 28 | # endif 29 | -------------------------------------------------------------------------------- /tests/tests/mix/000_launcher.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "ft_printf.h" 3 | #include "mix.h" 4 | 5 | /* Load test format: 6 | if ((err = load_test(&test_list, "TMPL_TEST_NAME", 7 | &mix_TMPL_TEST_FCT_NAME, SUCCESS))) 8 | return (err); 9 | */ 10 | 11 | int mix_launcher(void) 12 | { 13 | t_unit_test *test_list; 14 | char *fct_name; 15 | int err; 16 | int fd; 17 | int fd_trace; 18 | 19 | fct_name = "mix"; 20 | err = 0; 21 | fd = TESTS_OUTPUT_FD; 22 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 23 | test_list = NULL; 24 | print_fct_name_fd(fct_name, fd); 25 | if (fd_trace != fd) 26 | print_fct_name_trace_fd(fct_name, fd_trace); 27 | if ((err = load_test(&test_list, "\"abcd%%efg%dgh%u%i%c%s%f\", -42, 42u, -56, 'z', \"this is a string followed by a float: \", 2.33456", 28 | &mix_various_mix_simple, SUCCESS))) 29 | return (err); 30 | if ((err = load_test(&test_list, "\"abcd%%efg%-23.10dgh%42.4u%+2.10i%-22c%.23s%.32f\", -42, 42u, -56, 'z', \"this is a string followed by a float: \", 2.33456", 31 | &mix_various_mix_with_flags, SUCCESS))) 32 | return (err); 33 | /*LOAD_TEST_HERE*/ 34 | return (launch_tests(&test_list, fd)); 35 | } 36 | -------------------------------------------------------------------------------- /tests/tests/mix/mix.h: -------------------------------------------------------------------------------- 1 | #ifndef mix_H 2 | # define mix_H 3 | 4 | int mix_various_mix_simple(void); 5 | int mix_various_mix_with_flags(void); 6 | /*PROTOTYPES_HERE*/ 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /tests/tests/no_type/001_empty_string.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "" 12 | 13 | int no_type_empty_string(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/no_type/002_newline.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "\n" 12 | 13 | int no_type_newline(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/no_type/003_normal_string.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "test12345678" 12 | 13 | int no_type_normal_string(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/no_type/004_normal_string_with_non_printable.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "test12345678\t\v\n" 12 | 13 | int no_type_normal_string_with_non_printable(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/no_type/005_normal_string_and_newline.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "test\n" 12 | 13 | int no_type_normal_string_and_newline(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/no_type/006_valid_percent_sign.c: -------------------------------------------------------------------------------- 1 | #include "frmk_libunit.h" 2 | #include "tests.h" 3 | #include "ft_printf.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | # define ARGS "%%|%%%%|%%%%%%|%%abc%%def%%ghi%%" 12 | 13 | int no_type_valid_percent_sign(void) 14 | { 15 | t_test_rslt test_rslt; 16 | int pfd[2]; 17 | int nbytes_read; 18 | int ret_value; 19 | int save_out; 20 | int err; 21 | int fd_trace; 22 | 23 | test_rslt = (t_test_rslt){NULL, NULL, 0, 0}; 24 | fd_trace = get_fd(TRACE_FILE, OUTPUT_MODE, OP_APPEND); 25 | if ((err = pipe_stdout(pfd, &save_out))) 26 | return (free_result(&test_rslt, err)); 27 | test_rslt.ref_ret = printf(ARGS); 28 | if ((err = read_pipe(&test_rslt.ref_str, &nbytes_read, pfd, &save_out))) 29 | return (free_result(&test_rslt, err)); 30 | if ((err = pipe_stdout(pfd, &save_out))) 31 | return (free_result(&test_rslt, err)); 32 | test_rslt.user_ret = ft_printf(ARGS); 33 | if ((err = read_pipe(&test_rslt.user_str, &nbytes_read, pfd, &save_out))) 34 | return (free_result(&test_rslt, err)); 35 | if ((test_rslt.user_ret != test_rslt.ref_ret) 36 | || memcmp(test_rslt.user_str, test_rslt.ref_str, test_rslt.ref_ret)) 37 | { 38 | print_test_result_values_trace(&test_rslt, fd_trace); 39 | ret_value = -1; 40 | } 41 | else 42 | { 43 | print_test_result_values_trace(&test_rslt, fd_trace); 44 | ret_value = 0; 45 | } 46 | return (free_result(&test_rslt, ret_value)); 47 | } 48 | -------------------------------------------------------------------------------- /tests/tests/no_type/no_type.h: -------------------------------------------------------------------------------- 1 | #ifndef no_type_H 2 | # define no_type_H 3 | 4 | int no_type_empty_string(void); 5 | int no_type_newline(void); 6 | int no_type_normal_string(void); 7 | int no_type_normal_string_with_non_printable(void); 8 | int no_type_normal_string_and_newline(void); 9 | int no_type_valid_percent_sign(void); 10 | int no_type_very_long_string(void); 11 | /*PROTOTYPES_HERE*/ 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /tests/tests/printf/printf.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* printf.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: jkettani +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2019/03/04 10:08:56 by jkettani #+# #+# */ 9 | /* Updated: 2019/03/04 10:09:11 by jkettani ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef PRINTF_H 14 | # define PRINTF_H 15 | 16 | int printf_basic_test(void); 17 | 18 | #endif 19 | --------------------------------------------------------------------------------