-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
618 lines (610 loc) · 20 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lusanche <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/15 18:31:15 by lusanche #+# #+# */
/* Updated: 2019/08/09 12:54:02 by emdiaz ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <ctype.h>
#include <stdio.h>
/*
** FUNCTIONS JUST FOR THIS TEST PURPOSES (definitions at the end of this file)
*/
void ft_add_char(char *s);
void ft_add_index(unsigned int index, char *s);
void ft_fill_a(char *s);
char ft_toupper_char(char c);
char ft_toindex(unsigned int index, char c);
int main(void)
{
printf("\n");
printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>> L I B F T T E S T <<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
printf("-----------------------------------------------------------------------------\n");
printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PART 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_memset]\n");
char s26[50];
strcpy(s26, "america");
ft_memset(s26, 'y', 4);//FT_MEMSET
printf("%s\n", s26);
printf("\n");
printf("[memset]\n");
char s27[50];
strcpy(s27, "america");
memset(s27, 'y', 4);
printf("%s\n", s27);
printf("-----------------------------------------------------------------------------\n");
printf("[ft_bzero]\n");
char s28[50];
strcpy(s28, "12345678");
ft_bzero(s28, 1);//FT_BZERO
printf("(%s)\n", s28);
printf("\n");
printf("[bzero]\n");
char s29[51];
strcpy(s29, "12345678");
bzero(s29, 1);
printf("(%s)\n", s29);
printf("-----------------------------------------------------------------------------\n");
printf("[ft_memcpy]\n");
char s30[50], s31[50];
strcpy(s30, "blue");
strcpy(s31, "black");
printf("%s\n", ft_memcpy(s30, s31, 3));//FT_MEMCPY
printf("\n");
printf("[memcpy]\n");
char s32[50], s33[50];
strcpy(s32, "blue");
strcpy(s33, "black");
printf("%s\n", memcpy(s32, s33, 3));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_memccpy]\n");
char s34[50], s35[50];
strcpy(s34, "rocky");
strcpy(s35, "ernest");
printf("%s\n", ft_memccpy(s34, s35, 'r', 4));//FT_MEMCCPY
printf("%s\n", s34);
printf("\n");
printf("[memccpy]\n");
char s36[50], s37[50];
strcpy(s36, "rocky");
strcpy(s37, "ernest");
printf("%s\n", memccpy(s36, s37, 'r', 4));
printf("%s\n", s36);
printf("-----------------------------------------------------------------------------\n");
printf("[ft_memmove]\n");
char s38[50], s39[50];
strcpy(s38, "jupi");
strcpy(s39, "saturn");
printf("%s\n", ft_memmove(s38, s39, 2));//FT_MEMMOVE
printf("\n");
printf("[memmove]\n");
char s40[50], s41[50];
strcpy(s40, "jupi");
strcpy(s41, "saturn");
printf("%s\n", memmove(s40, s41, 2));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_memchr]\n");
char s42[50];
strcpy(s42, "mountain");
printf("%s\n", ft_memchr(s42, 'n', 4));//FT_MEMCHR
printf("%s\n", s42);
printf("\n");
printf("[memchr]\n");
char s43[50];
strcpy(s43, "mountain");
printf("%s\n", memchr(s43, 'n', 4));
printf("%s\n", s43);
printf("-----------------------------------------------------------------------------\n");
printf("[ft_memcmp]\n");
char s44[50], s45[50];
strcpy(s44, "a");
strcpy(s45, "aaa");
printf("%d\n", ft_memcmp(s44, s45, 2));//FT_MEMCMP
printf("\n");
printf("[memcmp]\n");
char s46[50], s47[50];
strcpy(s46, "a");
strcpy(s47, "aaa");
printf("%d\n", memcmp(s46, s47, 2));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strlen]\n");
printf("%zu\n", ft_strlen("longitud"));// FT_STRLEN
printf("\n");
printf("[strlen]\n");
printf("%lu\n", strlen("longitud"));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strdup]\n");
printf("%s\n", ft_strdup("Anthony"));//FT_STRDUP
printf("\n");
printf("[strdup]\n");
printf("%s\n", strdup("Anthony"));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strcpy]\n");
char s1 [50];
printf("%s\n", ft_strcpy(s1, "life"));//FT_STRCPY
printf("\n");
char s2 [50];
printf("[strcpy]\n");
printf("%s\n", strcpy(s2, "life"));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strncpy]\n");
char s3 [50];
printf("%s\n", ft_strncpy(s3, "metropolis", 3));//FT_STRNCPY
printf("\n");
printf("[strncpy]\n");
char s4 [50];
printf("%s\n", strncpy(s4, "metropolis", 3));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strcat]\n");
char s5[50], s6[50];
strcpy(s5, "Luis");
strcpy(s6, "Sanchez");
printf("%s\n", ft_strcat(s5, s6));//FT_STRCAT
printf("\n");
printf("[strcat]\n");
char s7[50], s8[50];
strcpy(s7, "Luis");
strcpy(s8, "Sanchez");
printf("%s\n", strcat(s7, s8));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strncat]\n");
char s9[50], s10[50];
strcpy(s9, "Chris");
strcpy(s10, "Cornell");
printf("%s\n", ft_strncat(s9, s10, 3));//FT_STRNCAT
printf("\n");
printf("[strncat]\n");
char s11[50], s12[50];
strcpy(s11, "Chris");
strcpy(s12, "Cornell");
printf("%s\n", strncat(s11, s12, 3));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strlcat]\n");
char s14[50], s15[50];
strcpy(s14, "Mr");
strcpy(s15, "Robot");
printf("%zu\n", ft_strlcat(s14, s15, 4));//FT_STRLCAT
printf("%s\n", s14);
printf("\n");
printf("[strlcat]\n");
char s16[50], s17[50];
strcpy(s16, "Mr");
strcpy(s17, "Robot");
printf("%lu\n", strlcat(s16, s17, 4));
printf("%s\n", s16);
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strchr]\n");
char *p1;
p1 = ft_strchr("yellow", 'l');//FT_STRCHR
printf("%s\n", p1);
printf("\n");
printf("[strchr]\n");
char *p2;
p2 = strchr("yellow", 'l');
printf("%s\n", p2);
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strrchr]\n");
char *p3;
p3 = ft_strrchr("yellow", 'l');//FT_STRRCHR
printf("%s\n", p3);
printf("\n");
printf("[strrchr]\n");
char *p4;
p4 = strrchr("yellow", 'l');
printf("%s\n", p4);
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strstr]\n");
char s18[50], s19[50];
strcpy(s18, "carbbono");
strcpy(s19, "bon");
char *p5;
p5 = ft_strstr(s18, s19);//FT_STRSTR
printf("%s\n", p5);
char s180[50], s190[50];
strcpy(s180, "ozarabozaraboze");
strcpy(s190, "ozaraboze");
char *p50;
p50 = ft_strstr(s180, s190);//FT_STRSTR
printf("%s\n", p50);
char s181[50], s191[50];
strcpy(s181, "pipapipapou");
strcpy(s191, "pipapou");
char *p51;
p51 = strstr(s181, s191);
printf("%s\n", p51);
printf("\n");
printf("[strstr]\n");
char s20[50], s21[50];
strcpy(s20, "carbbono");
strcpy(s21, "bon");
char *p6;
p6 = ft_strstr(s20, s21);
printf("%s\n", p6);
char s200[50], s210[50];
strcpy(s200, "ozarabozaraboze");
strcpy(s210, "ozaraboze");
char *p60;
p60 = strstr(s200, s210);
printf("%s\n", p60);
char s201[50], s211[50];
strcpy(s201, "pipapipapou");
strcpy(s211, "pipapou");
char *p61;
p61 = strstr(s201, s211);
printf("%s\n", p61);
printf("-----------------------------------------------------------------------------\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strnstr]\n");
char s22[50], s23[50];
strcpy(s22, "tritricolor");
strcpy(s23, "tric");
char *p7;
p7 = ft_strnstr(s22, s23, 7);//FT_STRNSTR
printf("%s\n", p7);
char s220[50], s230[50];
strcpy(s220, "ozarabozaraboze123");
strcpy(s230, "ozaraboze");
char *p70;
p70 = strnstr(s220, s230, 15);
printf("%s\n", p70);
printf("\n");
printf("[strnstr]\n");
char s24[50], s25[50];
strcpy(s24, "tritricolor");
strcpy(s25, "tric");
char *p8;
p8 = strnstr(s24, s25, 7);
printf("%s\n", p8);
char s240[50], s250[50];
strcpy(s240, "ozarabozaraboze123");
strcpy(s250, "ozaraboze");
char *p80;
p80 = strnstr(s240, s250, 15);
printf("%s\n", p80);
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strcmp]\n");
printf("%d\n", ft_strcmp("hola", "hol"));//FT_STRCMP
printf("\n");
printf("[strcmp]\n");
printf("%d\n", strcmp("hola", "hol"));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strncmp]\n");
printf("%d\n", ft_strncmp("uola", "hol", 3));//FT_STRNCMP
printf("\n");
printf("[strncmp]\n");
printf("%d\n", strncmp("uola", "hol", 3));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_atoi]\n");
printf("%d\n", ft_atoi(" \t\n\v\f\r -1986abc "));//FT_ATOI
printf("\n");
printf("[atoi]\n");
printf("%d\n", atoi(" \t\n\v\f\r -1986abc "));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_isalpha]\n");
printf("%d\n", ft_isalpha('h'));//FT_ISALPHA
printf("%d\n", ft_isalpha('*'));//FT_ISALPHA
printf("\n");
printf("[isalpha]\n");
printf("%d\n", isalpha('h'));
printf("%d\n", isalpha('*'));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_isdigit]\n\n");
printf("\"digit '3'\"\t");
(ft_isdigit('3')) ? (printf("is digit\n")) : (printf("is not digit\n"));// FT_ISDIGIT
printf("\"not digit 'h'\"\t");
(ft_isdigit('h')) ? (printf("is digit\n")) : (printf("is not digit\n"));// FT_ISDIGIT
printf("\"not digit 11\"\t");
(ft_isdigit(11)) ? (printf("is digit\n")) : (printf("is not digit\n"));// FT_ISDIGIT
printf("\"digit 48\"\t");
(ft_isdigit(48)) ? (printf("is digit\n")) : (printf("is not digit\n"));// FT_ISDIGIT
printf("-----------------------------------------------------------------------------\n");
printf("[ft_isalnum]\n");
printf("%d\n", ft_isalnum('5'));//FT_ISALNUM
printf("%d\n", ft_isalnum('+'));//FT_ISALNUM
printf("\n");
printf("[isalnum]\n");
printf("%d\n", isalnum('5'));
printf("%d\n", isalnum('+'));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_isascii]\n");
printf("%d\n", ft_isascii('~'));//FT_ISASCII
printf("%d\n", ft_isascii('8'));//FT_ISASCII
printf("\n");
printf("[isascii]\n");
printf("%d\n", isascii('~'));
printf("%d\n", isascii('8'));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_isprint]\n");
printf("%d\n", ft_isprint('\t'));//FT_ISPRINT
printf("\n");
printf("[isprint]\n");
printf("%d\n", isprint('\t'));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_toupper]\n");
printf("%c\n", ft_toupper('a'));//FT_TOUPPER
printf("\n");
printf("[toupper]\n");
printf("%c\n", toupper('a'));
printf("-----------------------------------------------------------------------------\n");
printf("[ft_tolower]\n");
printf("%c\n", ft_tolower('A'));//FT_TOLOWER
printf("\n");
printf("[tolower]\n");
printf("%c\n", tolower('A'));
printf("-----------------------------------------------------------------------------\n");
printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PART 2 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_memalloc]\n");
char *s51;
s51 = ft_memalloc(3);//FT_MEMALLOC
printf("%d\n",*s51);
strcpy(s51, "hi");
printf("%s\n", s51);
printf("\n");
printf("[expected]\n");
printf("0\nhi\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_memdel]\n");
char **tofree;
tofree = ft_memalloc(1);
tofree[0] = ft_memalloc(3);
tofree[0][0] = 'p';
tofree[0][1] = 'u';
tofree[0][2] = '\0';
tofree[1] = NULL;
printf("%s\n", tofree[0]);
printf("%d\n", (int)tofree[0]);
printf("----------\n");
ft_memdel((void **)tofree);//FT_MEMDEL
printf("%s\n", tofree[0]);
printf("%d\n", (int)tofree[0]);
printf("\n");
printf("[expected]\n");
printf("pu\n(some adress)\n----------\n(null)\n0\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strnew]\n");
char *s52;
s52 = ft_strnew(5);//FT_STRNEW
printf("(%s)\n", s52);
printf("\n");
printf("[expected]\n");
printf("(empty)\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strdel]\n");
char **tofree2;
tofree2 = ft_memalloc(1);
tofree2[0] = ft_strnew(2);
tofree2[0][0] = 'y';
tofree2[0][1] = 'o';
tofree2[0][2] = '\0';
tofree2[1] = NULL;
printf("%s\n", tofree2[0]);
printf("%d\n", (int)tofree2[0]);
printf("----------\n");
ft_strdel(tofree2);//FT_STRDEL
printf("%s\n", tofree2[0]);
printf("%d\n", (int)tofree2[0]);
printf("\n");
printf("[expected]\n");
printf("yo\n(some adress)\n----------\n(null)\n0\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strclr]\n");
char s13 [50];
printf("%s\n", strcpy(s13, "Pluton"));
ft_strclr(s13);//FT_STRCLR
printf("(%s)\n", s13);
printf("\n");
printf("[expected]\n");
printf("Pluton\n");
printf("(empty)\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_striter]\n");
char s49[50];
strcpy(s49, "Adam Ondra");
ft_striter(s49, ft_add_char);//FT_STRITER ft_add_char
printf("\n");
printf("\n");
printf("[expected]\n");
printf("A-d-a-m- -O-n-d-r-a-\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_striteri]\n");
char s50[50];
strcpy(s50, "Shauna");
ft_striteri(s50, ft_add_index);//FT_STRITERI ft_add_index
printf("\n");
printf("\n");
printf("[expected]\n");
printf("S[0]h[1]a[2]u[3]n[4]a[5]\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strmap]\n");
char *s53;
s53 = ft_strmap("animation", ft_toupper_char);//FT_STRMAP ft_toupper_char
printf("%s\n", s53);
printf("\n");
printf("[expected]\n");
printf("ANIMATION\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strmapi]\n");
char *s54;
s54 = ft_strmapi("australia", ft_toindex);//FT_STRMAPI ft_toindex
printf("%s\n", s54);
printf("\n");
printf("[expected]\n");
printf("012345678\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strequ]\n");
printf("%d\n", ft_strequ("lex", "lex"));//FT_STREQU
printf("\n");
printf("[expected]\n");
printf("1\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strnequ]\n");
printf("%d\n", ft_strnequ("levis", "lev", 3));//FT_STRNEQU
printf("\n");
printf("[expected]\n");
printf("1\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strsub]\n");
char *s55;
s55 = ft_strsub("A star is born", 2, 4);//FT_STRSUB
printf("%s\n", s55);
printf("\n");
printf("[expected]\n");
printf("star\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strjoin]\n");
char *s56;
s56 = ft_strjoin("Jack", "son");//FT_STRJOIN
printf("%s\n", s56);
printf("%lu\n", strlen(s56));
printf("\n");
printf("[expected]\n");
printf("Jackson\n7\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strtrim]\n");
char *s57;
s57 = ft_strtrim("\t \nh,o,l,a, \t\n ");//FT_STRTRIM
printf("%s\n", s57);
printf("%lu\n", ft_strlen(s57));
printf("\n");
printf("[expected]\n");
printf("h,o,l,a,\n8\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strsplit]\n");
char **s58;
s58 = ft_strsplit("*hola***como**te*va**", '*');//FT_STRSPLIT
printf("%s", s58[0]);
printf("%lu\n", ft_strlen(s58[0]));
printf("%s", s58[1]);
printf("%lu\n", ft_strlen(s58[1]));
printf("%s", s58[2]);
printf("%lu\n", ft_strlen(s58[2]));
printf("%s", s58[3]);
printf("%lu\n", ft_strlen(s58[3]));
printf("%s\n", s58[4]);
printf("\n");
printf("[expected]\n");
printf("hola4\ncomo4\nte2\nva2\n(null)\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_itoa]\n");
printf("%s\n", ft_itoa(198600));//FT_ITOA
printf("\n");
printf("[expected]\n");
printf("198600\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_putchar]\n");
ft_putchar('f');//FT_PUTCHAR
printf("\n\n");
printf("[printf]\n");
printf("f\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_putstr]\n");
ft_putstr("hello world!");// FT_PUTSTR
printf("\n\n");
printf("[printf]\n");
printf("hello world!\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_putendl]\n");
ft_putendl("hello mars!");// FT_PUTENDL
printf("\n");
printf("[printf]\n");
printf("hello mars!\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_putnbr]\n");
ft_putnbr(-2147483648);// FT_PUTNBR
printf("\n");
ft_putnbr(-12345);// FT_PUTNBR
printf("\n");
ft_putnbr(1986);// FT_PUTNBR
printf("\n\n");
printf("[printf]\n");
printf("%ld\n", -2147483648);
printf("%d\n", -12345);
printf("%d\n", 1986);
printf("-----------------------------------------------------------------------------\n");
printf("[ft_putchar_fd]\n");
ft_putchar_fd('g', 1);//FT_PUTCHAR_FD
printf("\n");
printf("\n");
printf("[expected]\n");
printf("g\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_putstr_fd]\n");
ft_putstr_fd("Muse", 1);//FT_PUTSTR_FD
printf("\n");
printf("\n");
printf("[expected]\n");
printf("Muse\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_putendl_fd]\n");
ft_putendl_fd("Thorn", 1);//FT_PUTENDL_FD
printf("\n");
printf("[expected]\n");
printf("Thorn\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_putnbr_fd]\n");
ft_putnbr_fd(-31416, 1);//FT_PUTNBR_FD
printf("\n");
printf("\n");
printf("[expected]\n");
printf("-31416\n");
printf("-----------------------------------------------------------------------------\n");
printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> BONUS PART <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
printf("-----------------------------------------------------------------------------\n");
printf("[ft_strlstnew]\n");
char *s59;
t_list *list1;
s59 = "42";
list1 = ft_lstnew(s59, 3);//FT_LSTNEW
printf("%s\n", list1->content);
printf("%zu\n", list1->content_size);
int conte[1];
t_list *list2;
conte[0] = 42;
list2 = ft_lstnew(conte, 4);//FT_LSTNEW
printf("%d\n", *((int *)list2->content));
printf("%zu\n", list2->content_size);
printf("\n");
printf("[expected]\n");
printf("42\n3\n42\n4\n");
printf("-----------------------------------------------------------------------------\n");
return(0);
}
/*
** for ft_striter
*/
void ft_add_char(char *s)
{
ft_putchar(*s);
ft_putchar('-');
}
/*
** for ft_striteri
*/
void ft_add_index(unsigned int index, char *s)
{
ft_putchar(*s);
ft_putchar('[');
ft_putnbr(index);
ft_putchar(']');
}
/*
** for ft_strmap
*/
char ft_toupper_char(char c)
{
return (c - 32);
}
/*
** for ft_strmapi
*/
char ft_toindex(unsigned int index, char c)
{
return (c - c + 48 + index);
}