commit
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,7 +1,7 @@
|
|||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
**/*~
|
**/*~
|
||||||
**/.*.swap
|
**/.*.swap
|
||||||
**/test_*
|
**/tests_*
|
||||||
|
|
||||||
# ---> C
|
# ---> C
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
ex=${1:?$0 <ex??>}
|
|
||||||
rm -f a.out
|
|
||||||
norminette -R CheckForbiddenSourceHeader ../${ex}/ft_*.c
|
|
||||||
#gcc ${ex}.c
|
|
||||||
gcc -Wall -Wextra -Werror -o a.out ${ex}.c
|
|
||||||
echo ${ex}:
|
|
||||||
./a.out "$@"
|
|
||||||
rm -f a.out
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ex00.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2021/08/11 12:02:38 by tkondrac #+# #+# */
|
|
||||||
/* Updated: 2021/08/12 12:14:00 by tkondrac ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "../ex00/ft_iterative_factorial.c"
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
printf("expected : 120 | result : %d\n", ft_iterative_factorial(5));
|
|
||||||
printf("expected : 1 | result : %d\n", ft_iterative_factorial(1));
|
|
||||||
printf("expected : 1 | result : %d\n", ft_iterative_factorial(0));
|
|
||||||
printf("expected : 0 | result : %d\n", ft_iterative_factorial(-5));
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ex01.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2021/08/11 12:07:21 by tkondrac #+# #+# */
|
|
||||||
/* Updated: 2021/08/12 12:13:50 by tkondrac ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "../ex01/ft_recursive_factorial.c"
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
printf("expected : 120 | result : %d\n", ft_recursive_factorial(5));
|
|
||||||
printf("expected : 1 | result : %d\n", ft_recursive_factorial(1));
|
|
||||||
printf("expected : 1 | result : %d\n", ft_recursive_factorial(0));
|
|
||||||
printf("expected : 0 | result : %d\n", ft_recursive_factorial(-5));
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ex02.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2021/08/11 12:07:52 by tkondrac #+# #+# */
|
|
||||||
/* Updated: 2021/08/11 12:15:32 by tkondrac ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "../ex02/ft_iterative_power.c"
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
printf("expected : 125 | result : %d\n", ft_iterative_power(5, 3));
|
|
||||||
printf("expected : -125 | result : %d\n", ft_iterative_power(-5, 3));
|
|
||||||
printf("expected : 1 | result : %d\n", ft_iterative_power(0, 0));
|
|
||||||
printf("expected : 1 | result : %d\n", ft_iterative_power(5, 0));
|
|
||||||
printf("expected : 0 | result : %d\n", ft_iterative_power(5, -5));
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ex03.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2021/08/11 12:14:15 by tkondrac #+# #+# */
|
|
||||||
/* Updated: 2021/08/11 12:15:17 by tkondrac ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "../ex03/ft_recursive_power.c"
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
printf("expected : 125 | result : %d\n", ft_recursive_power(5, 3));
|
|
||||||
printf("expected : -125 | result : %d\n", ft_recursive_power(-5, 3));
|
|
||||||
printf("expected : 1 | result : %d\n", ft_recursive_power(0, 0));
|
|
||||||
printf("expected : 1 | result : %d\n", ft_recursive_power(5, 0));
|
|
||||||
printf("expected : 0 | result : %d\n", ft_recursive_power(5, -5));
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ex04.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2021/08/11 12:16:43 by tkondrac #+# #+# */
|
|
||||||
/* Updated: 2021/08/11 12:19:42 by tkondrac ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "../ex04/ft_fibonacci.c"
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
i = -3;
|
|
||||||
while (i < 10)
|
|
||||||
{
|
|
||||||
printf("index %d : %d\n", i, ft_fibonacci(i));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ex05.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2021/08/11 12:41:14 by tkondrac #+# #+# */
|
|
||||||
/* Updated: 2021/08/11 12:49:26 by tkondrac ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include "../ex05/ft_sqrt.c"
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
printf("expected : 7 | result : %d\n", ft_sqrt(49));
|
|
||||||
printf("expected : 0 | result : %d\n", ft_sqrt(42));
|
|
||||||
printf("expected : 1 | result : %d\n", ft_sqrt(1));
|
|
||||||
printf("expected : 0 | result : %d\n", ft_sqrt(0));
|
|
||||||
printf("expected : 0 | result : %d\n", ft_sqrt(-1));
|
|
||||||
printf("expected : 0 | result : %d\n", ft_sqrt(2147483647));
|
|
||||||
printf("expected : 46340 | result : %d\n", ft_sqrt(2147395600));
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ex06.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: tkondrac <tkondrac@student.42lausan> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2021/08/11 12:59:31 by tkondrac #+# #+# */
|
|
||||||
/* Updated: 2021/08/11 13:10:05 by tkondrac ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include "../ex06/ft_is_prime.c"
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
printf("input 42 expected : 0 | result : %d\n", ft_is_prime(42));
|
|
||||||
printf("input 2 expected : 1 | result : %d\n", ft_is_prime(2));
|
|
||||||
printf("input 3 expected : 1 | result : %d\n", ft_is_prime(3));
|
|
||||||
printf("input 79 expected : 1 | result : %d\n", ft_is_prime(79));
|
|
||||||
printf("input 0 expected : 0 | result : %d\n", ft_is_prime(0));
|
|
||||||
printf("input 1 expected : 0 | result : %d\n", ft_is_prime(1));
|
|
||||||
printf("input -4 expected : 0 | result : %d\n", ft_is_prime(-4));
|
|
||||||
printf("input -2147483648 expected : 0 | result : %d\n", ft_is_prime(-2147483648));
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include "../ex07/ft_find_next_prime.c"
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
printf("input 42 expected : 43 | result : %d\n", ft_find_next_prime(42));
|
|
||||||
printf("input 0 expected : 2 | result : %d\n", ft_find_next_prime(0));
|
|
||||||
printf("input 9 expected : 11 | result : %d\n", ft_find_next_prime(9));
|
|
||||||
printf("input 2147483647 expected : 2147483647 | result : %d\n", ft_find_next_prime(2147483647));
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user