diff --git a/README.md b/README.md index d4c70da..f09966e 100644 --- a/README.md +++ b/README.md @@ -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.pl``` (replace THEIR_WORK_REPO with the repo that you cloned, and config.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 config_d.pl`
+ Replacing the placeholders! This will create the test files for all the exercises. +5. Run `./tools/build.sh`
+ Build the exercies' files with the provided main.c's. +6. Run `./tools/verify.sh`
+ This makes norminette verify all the files. (Only works from the iMacs in the labs.) +7. Run `./tools/check_all.sh`
+ 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 +... +``` diff --git a/config_d05.pl b/config_d05.pl index 7f87da8..e3c8cd7 100644 --- a/config_d05.pl +++ b/config_d05.pl @@ -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 diff --git a/config_d07.pl b/config_d07.pl index fee6dd7..0289de3 100644 --- a/config_d07.pl +++ b/config_d07.pl @@ -20,6 +20,8 @@ ex01 int* ft_range(int min, int max) main -m ==== +#include +#include int* res; int i; res = ft_range(5, 10); @@ -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, @@ -57,6 +59,7 @@ 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"); @@ -64,6 +67,7 @@ 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"); @@ -71,12 +75,16 @@ 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 '; ==== diff --git a/config_d11.pl b/config_d11.pl index 007da42..b528a5a 100644 --- a/config_d11.pl +++ b/config_d11.pl @@ -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", ); ==== @@ -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); @@ -948,23 +948,3 @@ "$program zxcv doop qwer asdf uiop hjkl vbnm" => "vbnm,hjkl,uiop,asdf,qwer,doop,zxcv,\n", ); ==== - - - - - - - - - - - - - - - - - - - -