-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kyle Breann
committed
Jan 19, 2023
1 parent
6896c49
commit 2a233ca
Showing
37 changed files
with
610 additions
and
743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
all: s21_cat s21_grep | ||
|
||
s21_cat: | ||
gcc -Wall -Werror -Wextra -std=c11 ./cat/s21_cat.c -o ./cat/s21_cat | ||
|
||
s21_grep: | ||
gcc -Wall -Werror -Wextra -std=c11 ./grep/s21_grep.c -o ./grep/s21_grep | ||
|
||
clean: | ||
rm ./cat/s21_cat | ||
rm ./grep/s21_grep | ||
|
||
rebuild: clean all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
all: s21_cat | ||
|
||
s21_cat: | ||
gcc -Wall -Werror -Wextra -std=c11 ./s21_cat.c -o s21_cat | ||
|
||
clean: | ||
rm ./s21_cat | ||
|
||
rebuild: clean all |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
make all | ||
|
||
echo " " | ||
echo "Response to wrong flag:" | ||
./s21_cat -q $test_file | ||
echo " " | ||
echo "Response to wrong file:" | ||
./s21_cat -$flag nofile.txt | ||
|
||
for flag in "-b" "-e" "-n" "-s" "-t" "-v" | ||
do | ||
test_number=1 | ||
echo " " | ||
echo "Flags: $flag:" | ||
for test_file in "tests_cat/test_text_1.txt" "tests_cat/test_text_2.txt" "./tests_cat/test_text_3.txt" "./tests_cat/test_text_4.txt" "./tests_cat/test_text_5.1.txt ./tests_cat/test_text_5.2.txt" "tests_grep/test_text_0.txt" "tests_grep/test_text_1.txt" "./tests_grep/test_text_2.txt" "./tests_grep/test_text_3.txt" "./tests_grep/test_text_4.txt" "./tests_grep/test_text_5.txt" "./tests_grep/test_text_6.txt" "./tests_grep/test_text_7.txt" "./tests_grep/test_text_ptrn.txt" "./tests_grep/test_text_6.txt ./tests_grep/test_text_6.txt" | ||
do | ||
./s21_cat $flag $test_file > 1.txt | ||
cat $flag $test_file > 2.txt | ||
if ! cmp -s 1.txt 2.txt ; then | ||
echo "Test $test_number: Fail" | ||
else | ||
echo "Test $test_number: Success" | ||
fi | ||
rm 1.txt 2.txt | ||
test_number=$(( $test_number + 1 )) | ||
done | ||
done | ||
echo " " | ||
echo " " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
make all | ||
|
||
for flag in "-b" "-e" "-n" "-s" "-t" "-E" "-T" | ||
do | ||
echo " " | ||
test_number=1 | ||
for test_file in "tests_grep/test_text_0.txt" "./tests_grep/test_text_1.txt" "./tests_grep/test_text_2.txt" "./tests_grep/test_text_3.txt" "./tests_grep/test_text_4.txt" "./tests_grep/test_text_5.txt" "./tests_grep/test_text_6.txt" "./tests_grep/test_text_7.txt" "./tests_grep/test_text_ptrn.txt" "tests_cat/test_text_1.txt" "tests_cat/test_text_2.txt" "./tests_cat/test_text_3.txt" "./tests_cat/test_text_4.txt" "./tests_cat/test_text_5.1.txt ./tests_cat/test_text_5.2.txt" | ||
do | ||
echo "Flag $flag, test $test_number:" | ||
valgrind --log-file="1.txt" ./s21_cat $flag $test_file > 1.txt | ||
tail -n4 ./1.txt | ||
echo " " | ||
rm 1.txt | ||
test_number=$(( $test_number + 1 )) | ||
done | ||
done | ||
echo " " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
str ! | ||
|
||
|
||
|
||
|
||
end. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
str ! | ||
|
||
|
||
|
||
|
||
end. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
str ! | ||
|
||
() | ||
() | ||
() | ||
end. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
str ! | ||
|
||
|
||
|
||
|
||
|
||
|
||
end. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Hello! | ||
Welcome to School 21. | ||
Here you can meet many intelligent and friendly people. | ||
Are you ready to start your education? | ||
|
||
Ten ... | ||
Nine ... | ||
Eight ... | ||
Seven ... | ||
Six ... | ||
|
||
|
||
|
||
|
||
Five... | ||
Four... | ||
Three... | ||
Two... | ||
One... | ||
|
||
|
||
MEOW! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Hi! | ||
|
||
It's a second text. | ||
|
||
One | ||
Two | ||
Three | ||
|
||
Meow | ||
|
||
|
||
MEOW! | ||
|
||
MeOw... | ||
|
||
|
||
Hwa hwa hwa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
srsblmrtb | ||
brrktbhm | ||
|
||
byh;r | ||
|
||
|
||
|
||
tgvrst | ||
|
||
Rtgr | ||
rag | ||
|
||
|
||
fy | ||
|
||
|
||
|
||
S | ||
S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2022 [email protected] | ||
#include "./s21_string.h" | ||
#include <stdlib.h> | ||
|
||
// Ф-я определения длины строки | ||
int s21_strlen(const char *str) { | ||
int size = 0; | ||
while (str[size] != '\0') | ||
size++; | ||
return size; | ||
} | ||
// Ф-я сравнения строк | ||
int s21_strcmp(const char *str1, const char *str2) { | ||
int cmp = 0; | ||
int s1 = s21_strlen(str1); | ||
int s2 = s21_strlen(str2); | ||
cmp = (s1 == s2 ? 0 : (s1 > s2 ? 1 : (-1))); | ||
return cmp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
^int | ||
|
||
|
||
)$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
int int int | ||
int int | ||
int |
Oops, something went wrong.