aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 3bde892f5cd1aa80db17086733804d0feb5dad31 (plain)
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
# ft_printf test

Unit test for the ft_printf project of 42 school.

![example_screenshot](./screenshot.png)

## Usage

Clone this repo such that:

```
`
|- ft_printf_test/
|- ft_printf/
```

or modify the `FT_PRINTF_PATH` variable in the Makefile

- `> make run`: run the tests in a pretty format
- `> make verbose`: to show a more verbose output
- `> make quiet`: to show a more quiet output
- `> make raw`: run the tests in a ugly but parsable format
- `> python3 prettier -h`: show prettier options
- `> make generate`: generate 100 random test

### Bonus

All the previous `make` command suffixed with `bonus` (i.e `make runbonus`). You may need
to `make fclean` in order to clean the previous .o files.

## Random Test Generator

It will generate random test according to the `-Wformat` flag of gcc.

- `> python3 generate.py -n [number of tests]`: generate n test
- `> python3 generate.py -h`: show all available options

### Bonus

Add the `--bonus` flag i.e: `> python3 generate.py -n [number of tests] --bonus`.

## Memory leaks check

You have to install [valgrind](http://valgrind.org/) with [brew](https://brew.sh/),
[here](https://stackoverflow.com/questions/35775102) is a nice thread to install it
locally if you don't have root access. You can then run `> brew install valgrind`.

- `> make check_leaks`: run valgrind on a test (without the test themself).
- `> make check_leaks_verbose`: add `--leak-check=full` to valgrind.

## Credits

- [moulitest](https://github.com/yyang42/moulitest) by yyang42
- [pft](https://github.com/gavinfielder/pft) by gavinfielder
- [printf\_tester](https://github.com/AntoineBourin/printf-tester) by AntoineBourin
- [printf\_tests](https://github.com/BartMassey/printf-tests) by BartMassey
- @MrHade for the no bonus test.