Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge updates in 42-Stupidity #1

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
#42 Stupidity
A tool for quickly testing answers to the piscine questions
# 42 Stupidity

##usage
clone this repository, and then clone a student's work repo inside of this one. run ```./spawn.pl THEIR_WORK_REPO/ config<day>.pl``` (replace THEIR_WORK_REPO with the repo that you cloned, and config<day>.pl with the name of the config file that you wish to test (they are named by day, so d02 would be config_d02.pl)). the spawn script will create test files for all exercises that it finds present.
A tool for quickly test solutions for the piscine exercises.

after spawning, run ```./tools/build.sh``` to build their files with the provided main.c's. run ```./tools/verify.sh``` to have norminette verify all files. finally, run ```./tools/check_all.sh``` to perform all tests. good tests will simply state 'good', errors will be printed with big exclamation marks.
## Usage

1. Clone 42us-stupidity
2. Go inside 42us-stupidity
3. Clone a day's repo inside 42us-stupidity
4. Run `./spawn.pl <day_repo> config_d<day_number>.pl`<br>
Replacing the placeholders! This will create the test files for all the exercises.
5. Run `./tools/build.sh`<br>
Build the exercies' files with the provided main.c's.
6. Run `./tools/verify.sh`<br>
This makes norminette verify all the files. (Only works from the iMacs in the labs.)
7. Run `./tools/check_all.sh`<br>
This will perform every test. If tests pass then they will say `good` otherwise errors are printed on the terminal.

## Example workflow

```
$ git clone https://github.com/mirror12k/42us-stupidity.git stupidMoulinette
...
$ cd stupidMoulinette
$ cp ~/Desktop/day03 day03
$ ./spawn.pl day03 config_d03.pl
...
$ ./tools/build.sh
...
$ ./tools/verify.sh
...
$ ./tools/check_all.sh
...
```
6 changes: 4 additions & 2 deletions config_d05.pl
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,12 @@
ex10
char* ft_strcapitalize(char* str)
main -m ====
char str[] = "asdf qWeRtY ZXCV 100TIS";
char str[] = "asdf qWeRtY ZXCV 100TIS\n";
printf("%s", ft_strcapitalize(str));
char str2[] = "asdf-qWeRtY ZXCV 100TIS";
printf("%s", ft_strcapitalize(str2));
==== check -e ====
$expected = 'Asdf Qwerty Zxcv 100tis';
$expected = "Asdf Qwerty Zxcv 100tis\nAsdf-Qwerty Zxcv 100tis";
====

ex11
Expand Down
10 changes: 9 additions & 1 deletion config_d07.pl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
ex01
int* ft_range(int min, int max)
main -m ====
#include <stdint.h>
#include <inttypes.h>
int* res;
int i;
res = ft_range(5, 10);
Expand All @@ -38,7 +40,7 @@
printf("\n");

res = ft_range(10, 5);
printf("%x\n", (unsigned int)res);
printf("%" PRIxPTR "\n", (uintptr_t) res);
==== check -e ====
$expected = '5,6,7,8,9,
-20,-19,-18,-17,-16,
Expand All @@ -57,26 +59,32 @@

size = ft_ultimate_range(&res, 5, 10);
printf("is_null? %d\n", res == NULL);
printf("size is %i\n", size);
for (i = 0; i < 5; i++)
printf("%d,", res[i]);
printf("\n");

res = NULL;
size = ft_ultimate_range(&res, -20, -17);
printf("is_null? %d\n", res == NULL);
printf("size is %i\n", size);
for (i = 0; i < 3; i++)
printf("%d,", res[i]);
printf("\n");

res = (int*)1;
size = ft_ultimate_range(&res, 10, 5);
printf("is_null? %d\n", res == NULL);
printf("size is %i\n", size);
==== check -e ====
$expected = 'is_null? 0
size is 5
5,6,7,8,9,
is_null? 0
size is 3
-20,-19,-18,
is_null? 1
size is 0
';
====

Expand Down
36 changes: 8 additions & 28 deletions config_d11.pl
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@
}
==== check -t ====
%tests = (
"$program" => "\n",
"$program asdf" => "asdf,\n",
"$program asdf qwer" => "qwer,asdf,\n",
"$program asdf qwer zxcv" => "zxcv,qwer,asdf,\n",
"$program ''" => ",\n",
"$program 15 '' 25" => "25,,15,\n",
"$program wat" => "wat,\n",
"$program" => "$program,\n",
"$program asdf" => "asdf,$program,\n",
"$program asdf qwer" => "qwer,asdf,$program,\n",
"$program asdf qwer zxcv" => "zxcv,qwer,asdf,$program,\n",
"$program ''" => ",$program,\n",
"$program 15 '' 25" => "25,,15,$program,\n",
"$program wat" => "wat,$program,\n",
);
====

Expand Down Expand Up @@ -278,7 +278,7 @@
l->next->next = CE("zxcv");
t_list* addresses[] = {l, l->next, l->next->next};
qsort(addresses, 3, sizeof(t_list*), (int(*)(const void*, const void*))compare_ints);

ft_list_clear(&l);
// verify that this is set to a null pointer now
printf("is null? %p\n", l);
Expand Down Expand Up @@ -948,23 +948,3 @@
"$program zxcv doop qwer asdf uiop hjkl vbnm" => "vbnm,hjkl,uiop,asdf,qwer,doop,zxcv,\n",
);
====