Code Monkey home page Code Monkey logo

libft-war-machine's Introduction

PREAMBLE

This is an edit of prev libftest made by @jtoty to fit with the 2019 project libft.
(ORIGINAL REP : https://github.com/jtoty/Libftest)
This update was made by @lmartin

libft-war-machine

This repository contains script to test your libft project. The script will do the following tests :
  • Check if the author file exists
  • Check content of the author file
  • Check if libft.h exists
  • Check norme of libft.h
  • Check if the Makefile file exists
  • Check rules in Makefile
  • Check compilation's flag in Makefile
  • Compil library
  • Check norme errors
  • Check forbidden functions
  • Tests functions

At the end of the tests, a deepthought file will be created, inside which you can find all the results and error/failure messages. You can also see your results in tests directory.

The script will compil your files with your libft, so you must have your Makefile up to date.

⚠️All the tests made are not the official tests⚠️

Getting Started

Installation

git clone https://github.com/y3ll0w42/libft-war-machine

Configuration

If you run the script for the first time, it will automatically create my_config.sh file and ask you to edit it with the path of your libft project. You can also choose the colors that will be used and the path where the deepthought file will be created.

Custom directories

If you use custom directories for your header and source files; you should specify there name in my_config.sh.

The following variables must be set:

HEADER_DIR
SRC_DIR

Exemple:

HEADER_DIR="includes"
SRC_DIR="srcs"

Running script

Go to the directory where you cloned and run the script

bash grademe.sh

or simply run the script with the path

bash /path/where/you/cloned/grademe.sh

Options available

Option Description
-h
--help
Display help and exit
-d Allows to perform the tests even if the files are in directories
-c Disable color
-s Disable searching Makefile and author files
-m When compiling library, test all the Makefile's rules (instead of doing only make re and checking if other rules exist).
-l Disable compiling library
-f Disable checking forbidden functions
-n Disable norminette
-u Disable checking updates at launch
-p1 Disable part 1 tests
-p2 Disable part 2 tests
-b Disable bonus part tests
-a Disable additional part tests
-op1 Do only part 1 tests
-op2 Do only part 2 tests
-ob Do only bonus part tests
-oa Do only additional part tests
ft_function Test only this function

Add successively all options you want, in the order you want. For example :

bash grademe.sh ft_atoi -f ft_strlen -n

Supported functions

All the supported functions are listed on this page.

Contribution

Any suggestions or bugs reporting ? Contact [email protected]

Contributors

libft-war-machine's People

Contributors

0x050f avatar cestoliv avatar creep33 avatar dh4rm4 avatar fedordikarev avatar gkintana avatar kuuuzya avatar lucaskuhn avatar xibaochat avatar xicodomingues avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

libft-war-machine's Issues

strsplit

A friend get killed in this test in the strsplit and passed in all of ur tests.

char *str = "1-2-3-4-5-6-7-8--8-8--8-4------4--4"
char *sep = '-'

char *str = "--1-2-3-4-5-6-7-8--8-8--8-4------4--4"
char *sep = '-'

Expected result: 1-2-3-4-5-6-7-8-8-8-8-4-4-4

RES[0]: $1$ -> 0x602000000210
RES[1]: $2$ -> 0x602000000230
RES[2]: $3$ -> 0x602000000250
RES[3]: $4$ -> 0x602000000270
RES[4]: $5$ -> 0x602000000290
RES[5]: $6$ -> 0x6020000002b0
RES[6]: $7$ -> 0x6020000002d0
RES[7]: $8$ -> 0x6020000002f0
RES[8]: $8$ -> 0x602000000310
RES[9]: $8$ -> 0x602000000330
RES[10]: $8$ -> 0x602000000350
RES[11]: $4$ -> 0x602000000370
RES[12]: $4$ -> 0x602000000390
RES[13]: $4$ -> 0x6020000003b0
RES[14]: $(null)$ -> (nil)

Do not work !

After few tries impossible to make the script work

Whateveer i do, the "path" was not the correct one it always take the path of the tester ...

clang: error: no such file or directory: '/mnt/c/.../42project/libft-war-machine/dirlibft/libft.a'

Seems like it happen only on compilation time ...

I'm using a WSL2 (kali-linux)

SRC_DIR and HEADER_DIR useless

Hello, it seems like your test program does not use SRC_DIR and HEADER_DIR variables at all, or the README is not clear enough.
(tested on Debian 10)

EDIT : nevermind, your script just doesn't understand my Makefile

Lst checks

I think the reason your list checks are not working is because your memcpy isnt working properly.

want me to do a PR?

Bonus files ending with _bonus aren't searched

According to @ska42 this should've been fixed in #19, but this doesn't seem to be the case.

Screen Shot 2021-11-25 at 4 46 56 PM

What I've been having to do so far is renaming all 9 bonus files to remove the _bonus suffix, and to also remove _bonus suffix from the hardcoded paths of the files in the Makefile (not allowed to use wildcards yet).

The deepthought file shows it errors when it searches for ft_lstnew.c, while it should fall back to ft_lstnew_bonus.c:

= Bonus_functions ==============================================================

= ft_lstnew_bonus.c ============================================================
$> norminette ft_lstnew_bonus.c | grep -E '(Error|Warning)'
$> clang -Wextra -Wall -Werror -g3 -fsanitize=address ft_lstnew.c main.c libft.a -o user_exe

clang: error: no such file or directory: '/Users/sbos/Evals/intra-uuid-479083c1-2738-490c-ae1f-f5457fb58ea4-3883824-1/libft-war-machine/dirlibft//ft_lstnew.c'

Here's my libft for reproducing my issue: libft-sbos.zip

ft_memccpy

ft_memccpy is not in the subject and should be deleted

Norminette not working for bonus files

Thanks first for the incredible tester!
I just realized that the tester marks norm as ok even though there are some norminette rules that I didn't follow (especially newlines).

So the norminette check does not seem to be working for the check of bonus files.

test 7 ft_memchr

test 7 for ft_memchr always aborts. Even when i replace ft_memchr by memchr it aborts. Parameter "size_t n" may be too long

ft_putnbr_fd new test case

It's a rather common mistake to have a >= instead of > as exit condition before recursion, so I think a test case simply for n = 10 would save some facepalm :)

Problem with str_dup

= ft_strdup.c ==================================================================
$> norminette ft_strdup.c | grep -E '(Error|Warning)'

norminette : command not found

$> clang -Wextra -Wall -Werror -g3 -fsanitize=address ft_strdup.c main.c libft.a -o user_exe

/home/irlalmeida/Documents/VSCode/42/libft-war-machine/tests/Part1_functions/ft_strdup/main.c:38:19: error: implicit declaration of function 'ft_strdup' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                if (!(str_dup = ft_strdup(str)))
                                ^
/home/irlalmeida/Documents/VSCode/42/libft-war-machine/tests/Part1_functions/ft_strdup/main.c:38:17: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Werror,-Wint-conversion]
                if (!(str_dup = ft_strdup(str)))
                              ^ ~~~~~~~~~~~~~~
2 errors generated.

I believe the error is with the program itself because the code compiles with other testers. However, I haven't submitted it to Moullinete yet

Installation instructions unclear

In the getting started section, after cloning the readme, it says:
"If you run the script for the first time"

Which script is meant by "the script"? This is unclear. The readme should be changed to clarify this. Furthermore, it is a better practice that one can simply cd into a project directory and run make and everything should be taken care of. That standard practice essentially standardizes installation procedures so that one does not need to bother thinking about what .sh file should be run, etc.

{} not detected in the Makefile

when the {} is used in the Makefile war-mchine dont find the target... my be that's can be good to fix that ?
for example '${name}:' is not detected, but '$(name):'

et merci pour le progrmme il est bien utile !!!

War machine outdated... :(

  • The moulinette expects bonus functions to be suffixed with _bonus, but War machine doesn't know about it. So, it doesn't test the functions.

  • Even if I change my function names + Makefile, the tests abort because of fsanitize raising an error in your mains.

Screen Shot 2019-12-05 at 9 47 11 PM

Screen Shot 2019-12-05 at 9 52 48 PM

Getting random test results when functions are correct

I followed your installation instructions and got it to run but the test results are not correct. They seem to be random
Take this for example:
Run 1
imagem
Run 2
imagem
Trace
imagem
Src for the function in question. (Happens in almost every other function)
imagem

[BUG] War Machine incorrectly expects bonus part files to be named with the _bonus suffix

I saw that the issue #14 stated that the bonus files (about linked lists) are expected to be ended with _bonus.c. But this is false. The _bonus suffix is meant to name files that contains functions which weren't asked in the subject.

I don't believe Moulinette will mark a file name as wrong, since they don't specify any. But this behavior makes this tester the only which doesn't grade the linked list bonus functions.

lstmap has comlil. failed only in this test!

✔ Preparing framework
✔ Executing: make fclean all bonus
ℹ Executing: libft-war-machine (https://github.com/y3ll0w42/libft-war-machine)

FUNCTION TESTS RESULT
ft_lstmap compil. failed KO

✔ Compiling tests: libftTester (https://github.com/Tripouille/libftTester)
ℹ Testing:
ft_lstmap : 1.OK 2.OK 3.OK 4.OK 5.OK 6.OK 7.OK 8.OK

✔ Compiling tests: libft-unit-test (https://github.com/alelievr/libft-unit-test)
ℹ Testing:
ft_lstmap : [OK]

✔ Compiling tests: fsoares (my own)
ℹ Testing:
ft_lstmap : OK

ft_memchr new test value

Hello,

I had a new experience with Moulinette, i wrong cast both the void * ( void *to char *) and the int ( int to unsigned int) in the function, yet the all the tests passed, but moulinette failed me. I suggest if possible to add a test for the memory value "ÿÿÿ1" and the char value 191, for this values my function failed.
I am sorry to bother, but i thought it will help other beginners like me, i did everything but i missed this one...

Thanks again

strlcat et split sigabort

Salut !

Déjà merci de nous avoir mis ce testeur à disposition, il est vraiment très pratique.

Cependant, y'a un problème avec strlcat et split : Le test 7 pour strlcat ne donne pas deux string mais une série de r sans \0 à la fin et une string. Pour split je sais pas quel est le problème exactement, le testeur donne des sigabort mais quand on test manuellement avec le main.c, tout se passe bien.

Voilà, merci encore pour ton aide !

Create seg fault at random test ...

Salut, quand je test certaines fonctions du style "is_digit" , "to_upper", ... bref des fonctions simples sans allocation de mémoire, et pourtant quand je les test il y a des seg fault qui apparaissent aléatoirement. Tout est bien setup. Merci d'avance

bonus files are not compiled

When i check compiling trace in deepthought, all my bonus files are missing. It seems that you don't use the bonus rule in makefiles. Is this intended and i should redeclare bonus functions that i want to use again ?

ft_calloc test says not_clean when including errno.h

I'm including errno.h and setting errno = ENOMEM as per the calloc manpage.

Although in some cases malloc will do this for us and it's not necessary, my code checks for overflow after multiplying count and size as follows:

#include <stdlib.h>
#include "libft.h"
#include <errno.h>

void	*ft_calloc(size_t count, size_t size)
{
	size_t	total_count;
	void	*ptr;

	if (count == 0 || size == 0)
	{
		ptr = malloc(1);
		ft_bzero(ptr, 1);
		return (ptr);
	}
	total_count = count * size;
	if (total_count / count != size)
	{
		errno = ENOMEM;
		return (NULL);
	}
	ptr = malloc(total_count);
	if (ptr == NULL)
		return (NULL);
	ft_bzero(ptr, total_count);
	return (ptr);
}

Problem with memchr.c

= ft_memchr.c ==================================================================
$> norminette ft_memchr.c | grep -E '(Error|Warning)'

norminette : command not found

$> clang -Wextra -Wall -Werror -g3 -fsanitize=address ft_memchr.c main.c libft.a -o user_exe

/home/irlalmeida/Documents/VSCode/42/libft-war-machine/tests/Part1_functions/ft_memchr/main.c:81:16: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                printf("%s", ft_memchr(tab, -1, 7));
                        ~~   ^~~~~~~~~~~~~~~~~~~~~
1 error generated.

I believe the error is with the program itself because the code compiles with other testers. However, I haven't submitted it to Moullinete yet

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.