in install sh install one more skeleton test

This commit is contained in:
Hugo LAMY
2022-07-05 15:14:32 +02:00
7 changed files with 104 additions and 28 deletions

View File

@@ -130,12 +130,17 @@ endfunction
function! COLORFile() function! COLORFile()
silent! 0r $HOME/.vim/templates/skeleton_colors.h silent! 0r $HOME/.vim/templates/skeleton_colors.h
endfunction endfunction
" to autofill a new tests.hpp file
function! TESTSFile()
silent! 0r $HOME/.vim/templates/skeleton_tests.hpp
endfunction
" autofill calls " autofill calls
autocmd BufNewFile *.hpp call HPPFile() autocmd BufNewFile *.hpp call HPPFile()
autocmd BufNewFile *.cpp if @% == 'main.cpp' | call MAINCPPFile() | else | call CPPFile() autocmd BufNewFile *.cpp if @% == 'main.cpp' | call MAINCPPFile() | else | call CPPFile()
autocmd BufNewFile Makefile call MAKEFile() autocmd BufNewFile Makefile call MAKEFile()
autocmd BufNewFile colors.h call COLORFile() autocmd BufNewFile colors.h call COLORFile()
autocmd BufNewFile testss.hpp call TESTSFile()

View File

@@ -1,46 +1,72 @@
# - - - - - - #
# #
# COLORS #
# #
# - - - - - - #
GRAY = "\e[0;30m"
RED = "\e[0;31m"
GREEN = "\e[0;32m"
YELLOW = "\e[0;33m"
BLUE = "\e[0;34m"
PURPLE = "\e[0;35m"
CYAN = "\e[0;36m"
WHITE = "\e[0;37m"
B_GRAY = "\e[1;30m"
B_RED = "\e[1;31m"
B_GREEN = "\e[1;32m"
B_YELLOW = "\e[1;33m"
B_BLUE = "\e[1;34m"
B_PURPLE = "\e[1;35m"
B_CYAN = "\e[1;36m"
B_WHITE = "\e[1;37m"
RESET = "\e[0m"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# . name = value \ . += append to a variable # # . name = value \ . += append to a variable #
# VARIABLES . value . != set result of command # # VARIABLES . value . != set result of command #
# . name is case sensitive . ?= set if not already set # # . name is case sensitive . ?= set if not already set #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
NAME = a.out NAME = a.out
#TYPE = c #CC = c
TYPE = cpp #EXT = c
CC = c++
EXT = cpp
ifeq "$(TYPE)" "c" CFLAGS = -Wall -Wextra -Werror $(INCLUDES)
CC = c #CFLAGS += -std=c++98
EXT = c CFLAGS += -g3
else ifeq "$(TYPE)" "cpp"
CC = c++
EXT = cpp
endif
CFLAGS = -Wall -Wextra -Werror $(INCLUDES) VPATH = $(D_SRCS)
ifeq "$(TYPE)" "cpp"
CFLAGS += -std=c++98
endif
VPATH = $(D_SRCS) LIBS =
LIBS = F_INCLUDES = $(HEADERS:%=$(D_HEADERS)/%) \
$(TEMPLATES:%=$(D_TEMPLATES)/%)
INCLUDES = -I$(D_HEADERS) \
-I$(D_TEMPLATES)
INCLUDES = -I$(D_HEADERS) D_SRCS = ./srcs
SRCS = main.c
D_SRCS = . D_HEADERS = ./headers
SRCS = main.cpp HEADERS = colors.h \
tests.hpp
D_HEADERS = . D_TEMPLATES = ./templates
HEADERS = colors.h TEMPLATES = template.tpp
D_OBJS = builds D_OBJS = builds
OBJS = $(SRCS:%.$(EXT)=$(D_OBJS)/%.o) OBJS = $(SRCS:%.$(EXT)=$(D_OBJS)/%.o)
ifeq "$(D_OBJS)" "." ifeq "$(D_OBJS)" "."
RM_OBJS = rm -f $(OBJS) RM_OBJS = rm -f $(OBJS)
else else
RM_OBJS = rm -rf $(D_OBJS) RM_OBJS = rm -rf $(D_OBJS)
endif endif
@@ -53,14 +79,16 @@ endif
all: $(NAME) all: $(NAME)
$(D_OBJS)/%.o: %.$(EXT) | $(D_OBJS) $(D_OBJS)/%.o: %.$(EXT) | $(D_OBJS)
@echo $(CYAN)"compilation (objects.o) :"$(RESET)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
$(D_OBJS): $(D_OBJS):
mkdir $@ mkdir $@
$(OBJS): $(HEADERS:%=$(D_HEADERS)/%) $(OBJS): $(F_INCLUDES)
$(NAME): $(OBJS) $(NAME): $(OBJS)
@echo $(CYAN)"linkage (link objects.o) :"$(RESET)
$(CC) $(OBJS) -o $@ $(LIBS) $(CC) $(OBJS) -o $@ $(LIBS)
leaks: $(NAME) leaks: $(NAME)

View File

@@ -0,0 +1,30 @@
#ifndef TESTS_H
# define TESTS_H
#include <vector>
#include <string>
# define TEST(s) \
{\
test_title = #s;\
struct tester : public test_base {\
void func()
# define TESTEND \
};\
test = new(tester);\
test->title = test_title;\
test_list.push_back(test);\
}
struct test_base {
std::string title;
virtual void func() {}
};
std::vector<test_base *> test_list;
test_base *test;
std::string test_title;
#endif

View File

@@ -75,6 +75,7 @@ install "$HOME/.screenrc"
install "$HOME/.vimrc" install "$HOME/.vimrc"
install "$HOME/.zshrc" install "$HOME/.zshrc"
install "$HOME/.vim/templates/skeleton_colors.h" install "$HOME/.vim/templates/skeleton_colors.h"
install "$HOME/.vim/templates/skeleton_tests.hpp"
install "$HOME/.vim/templates/skeleton.cpp" install "$HOME/.vim/templates/skeleton.cpp"
install "$HOME/.vim/templates/skeleton.hpp" install "$HOME/.vim/templates/skeleton.hpp"
install "$HOME/.vim/templates/skeleton_main.cpp" install "$HOME/.vim/templates/skeleton_main.cpp"

View File

@@ -33,7 +33,10 @@
**git stash pop** reapply the stashed changes and removes them from the stash area **git stash pop** reapply the stashed changes and removes them from the stash area
**git stash apply** reaply the stashed changes and keep them in the stash area **git stash apply** reaply the stashed changes and keep them in the stash area
**git config --global credential.helper store** store the passwords in .git-credentials in the HOME directory (thanks to global, as opposed to the project directory) so you don't have tot type it each time **git config --global credential.helper store** store the passwords in .git-credentials in the HOME directory (thanks to global, as opposed to the project directory) so you don't have tot type it each time
**git cherry-pick NAME_OF_BRANCH** ti merge a branch into the actual one, but only with the last commit **git config --global core.editor "vim"** change the git editor for vim
**git cherry-pick NAME_OF_BRANCH** it merge a branch into the actual one, but only with the last commit
**git log --graph** show the graph of the commits with branchs
**git log --first-parent master** show all the commits directly on master (or other branch)
**relier dossier sur serveur en local avec git** **relier dossier sur serveur en local avec git**
**acceder au serveur via ssh :** **acceder au serveur via ssh :**
`ssh hugugtzx@world-370.fr.planethoster.net -p 5022` `ssh hugugtzx@world-370.fr.planethoster.net -p 5022`

View File

@@ -7,9 +7,12 @@
**mkdir file{1..10}** creer 10 dossiers nommés de file1 à file10 **mkdir file{1..10}** creer 10 dossiers nommés de file1 à file10
**pwd** print working directory **pwd** print working directory
**xdg-open .** open working directory **xdg-open .** open working directory
**du -sh** directory sizes
**ncdu** (visual version of 'du' command) quick presentation of directories size **ncdu** (visual version of 'du' command) quick presentation of directories size
**ssh username@ssh.server.com -p 0000** se connecter a un serveur via ssh en precisant un port **ssh username@ssh.server.domain -p XXXX** se connecter a un serveur via ssh en precisant un port
**sftp -P XXXX username@ssh.server.domain** se connecter a un server ssh avec le protocol ftp
**vim scp://username@ssh.server.domain:XXXX//home/path/to/file** edit a remote file from local vim
**pdftotext** transforme un pdf en un fichier texte **pdftotext** transforme un pdf en un fichier texte
**^** designe le debut d'une ligne **^** designe le debut d'une ligne

View File

@@ -1,3 +1,9 @@
/SYNTAX/
to create a new syntax file, just copy an existing one :
cp /usr/share/vim/vimXX/syntax/extension.vim ~/.vim/syntax/
and change the name to match the extension
and change the content to whatever you want
/MODE INSERTION/ /MODE INSERTION/
**i** mode insertion avant le curseur **i** mode insertion avant le curseur
**I** mode insertion au debut de la ligne **I** mode insertion au debut de la ligne