This repo is a fork of the Unity Test Project, one of the main projects of ThrowTheSwitch.org.
Everyone can add tests to test_libft/test
directory of this repo. Each test file will be compiled to an executable named test_yourlogin.out
in targets
directory and run separately. The test depends on two symbolic links libft.h
and libft.a
which points to your header file and static library, meaning that you can put this repo outside of your workspace and run independently.
The docs
directory contains a "Getting started guide" and much more tips about using Unity.
- Go to
test_libft
- Create symbolic link
libft.a
andlibft.h
to your static library and header respectively. - Type
make -s
and hit Enter. The option-s
will preventmake
from printing all the commands it runs.
- Go to
test_libft/test
- Create a C file whose name follows the format
test_yourLogin.c
. By doing this, if someone want to contact you regarding your test file, they know how to reach you. Below is an example of a test file:
#include "libft.h"
#include "unity.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_strlen(void)
{
TEST_ASSERT_EQUAL(3, ft_strlen("abc"));
}
Please note that even though setup()
and tearDown()
are empty, you should not remove it. Otherwise, the test will not run. Please refer to the documentation for more information.
Name of each test function needs to start with test
. Otherwise, the test function will not be recognized by the test runner, and thus will not run.
It is recommended that each Hiver has his/her own test file and don't modify the others to avoid conflicts. You can provide feedbacks to others' tests by leaving a comment on GitHub and don't forget to enable GitHub notification.
If you want to split your test code into multiple files, feel free to do it. However, please remember to put your login in the test file.
If you want to make your test files visible on this GitHub, please follow this instruction on how to contribute to a GitHub project