tests 25
This commit is contained in:
Submodule BUT1-Test-Public deleted from 7b3b5739aa
BIN
TestsUnitaires/1TestCM1.pdf
Normal file
BIN
TestsUnitaires/1TestCM1.pdf
Normal file
Binary file not shown.
BIN
TestsUnitaires/1TestTD1.pdf
Normal file
BIN
TestsUnitaires/1TestTD1.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
TestsUnitaires/2TestCM2-2024.pdf
Normal file
BIN
TestsUnitaires/2TestCM2-2024.pdf
Normal file
Binary file not shown.
BIN
TestsUnitaires/2TestCM2.pdf
Normal file
BIN
TestsUnitaires/2TestCM2.pdf
Normal file
Binary file not shown.
BIN
TestsUnitaires/2TestTD2.pdf
Normal file
BIN
TestsUnitaires/2TestTD2.pdf
Normal file
Binary file not shown.
BIN
TestsUnitaires/2TestTP2-TestsUnitairesAvecJunit.pdf
Normal file
BIN
TestsUnitaires/2TestTP2-TestsUnitairesAvecJunit.pdf
Normal file
Binary file not shown.
BIN
TestsUnitaires/3TPTools.pdf
Normal file
BIN
TestsUnitaires/3TPTools.pdf
Normal file
Binary file not shown.
BIN
TestsUnitaires/3TestCM-2024.pdf
Normal file
BIN
TestsUnitaires/3TestCM-2024.pdf
Normal file
Binary file not shown.
BIN
TestsUnitaires/3TestCM3.pdf
Normal file
BIN
TestsUnitaires/3TestCM3.pdf
Normal file
Binary file not shown.
339
TestsUnitaires/4CMDivers.md
Normal file
339
TestsUnitaires/4CMDivers.md
Normal file
@@ -0,0 +1,339 @@
|
||||
# Divers outils
|
||||
|
||||
Nous allons maintenant (re)voir divers outils utiles pour faire du développement.
|
||||
|
||||
## Contrôle de version
|
||||
|
||||
Il existe de nombreux outils permettant de
|
||||
* mémoriser une version antérieure d'un fichier
|
||||
* partager ce fichier
|
||||
* revenir à une version antérieure
|
||||
|
||||
Pour certains fichiers, il existe un système de suivi de version intégré à l'outil permettant de l'éditer. Par exemple, le suivi de version de word.
|
||||
|
||||
Il existe maintenant des clients avec un serveur centralisé de sauveguarde utilisés par le grand public (NextCloud, Dropbox, etc) et des outils plutôt pour les développeurs (subversion, git, etc).
|
||||
|
||||
Nous allons nous pencher sur git que vous utilisez depuis quelques mois [diaporama Denis](git_tutorial.pdf).
|
||||
|
||||
En TP, nous allons voir git plus en détails, en particulier comment travailler à plusieurs (merge, rebase).
|
||||
|
||||
## Mark down
|
||||
|
||||
Pour faire des readme, des rapports simples, le mark down fonctionne très bien.
|
||||
C'est un fichier texte qui est interprété entre autre par le client web des serveurs git pour un rendu assez raisonnable.
|
||||
|
||||
Le format n'est pas complètement standardisé toutefois, donc veillez à rester sur des choses universelles pour faciliter le rendu.
|
||||
|
||||
## LaTeX
|
||||
|
||||
Pour des rapports plus conséquents (à partir de 4 ou 5 pages qu'on voudra imprimer), il vaut mieux utiliser un outil permettant de garantir un résultat typographiquement supérieur ce qui offira une lecture plus confortable.
|
||||
|
||||
Par exemple voici mon fichier pour une feuille de TD.
|
||||
On peut aussi faire des lettres, des posters, des présentations.
|
||||
|
||||
```latex
|
||||
\documentclass[a4paper,12pt]{article}
|
||||
|
||||
\usepackage[francais]{babel} %%% ponctuation etc en français
|
||||
\usepackage[utf8]{inputenc} %%% saisir de l'utf8 dans le texte
|
||||
\usepackage[T1]{fontenc} %%% chargement d'une police décorée avec les accents
|
||||
\usepackage{lmodern} %%% je souhaite la police lmodern
|
||||
\usepackage{graphics,graphicx}%%% pour importer des images
|
||||
\usepackage{url} %%% pour citer des urls, des adresses mails
|
||||
\usepackage{hyperref} %%% hyperliens dans le pdf
|
||||
\usepackage[pdftex,usenames,dvipsnames]{xcolor} %%% gestion des couleurs
|
||||
%%% decommenter si tikz necessaire
|
||||
%\usepackage{tikz} %%% dessiner programmatiquement.
|
||||
%\usetikzlibrary[decorations.pathmorphing]
|
||||
%\usetikzlibrary[decorations.pathreplacing]
|
||||
%\usetikzlibrary{backgrounds}
|
||||
%\usetikzlibrary{positioning}
|
||||
%\usetikzlibrary{arrows}
|
||||
%\usetikzlibrary{backgrounds}
|
||||
|
||||
|
||||
\usepackage{tcolorbox} %%% boîtes de couleurs
|
||||
\tcbset{textmarker/.style={%
|
||||
% skin=enhancedmiddlejigsaw,breakable,
|
||||
parbox=false,
|
||||
boxrule=0mm,leftrule=5mm,rightrule=5mm,boxsep=0mm,arc=0mm,outer arc=0mm,
|
||||
left=3mm,right=3mm,top=1mm,bottom=1mm,toptitle=1mm,bottomtitle=1mm,oversize}}
|
||||
\newtcolorbox{yellow}{textmarker,colback=yellow!5!white,colframe=yellow}
|
||||
\newtcolorbox{orange}{textmarker,colback=DarkOrange!5!white,
|
||||
colframe=DarkOrange!75!yellow}
|
||||
\newtcolorbox{red}{textmarker,colback=red!5!white,colframe=red}
|
||||
\newtcolorbox{blue}{textmarker,colback=DeepSkyBlue!5!white,colframe=DeepSkyBlue}
|
||||
\newtcolorbox{green}{textmarker,colback=Chartreuse!5!white,colframe=Chartreuse}
|
||||
\newtcolorbox{rainbow}{textmarker,interior hidden,
|
||||
frame style={top color=blue,bottom color=red,middle color=green}}
|
||||
%%%
|
||||
|
||||
\usepackage{framed} %%% boîtes permettant de gérer correctement le saut de page.
|
||||
\usepackage{multicol} %%% plusieurs colonnes
|
||||
\usepackage[subtle]{savetrees} %%% économiser du papier tout en restant lisible.
|
||||
%\usepackage[a4paper,width=17cm,height=23cm]{geometry} %%% changer les marges
|
||||
\usepackage{a4wide} %%% version simple du précédent
|
||||
\usepackage{paralist} %%%
|
||||
\usepackage{fancyhdr} %%% haut de page
|
||||
\usepackage{colortbl} %%% tables de couleur
|
||||
\usepackage{cancel} %%%
|
||||
\usepackage{amssymb,amsmath,amsthm} %%% Maths symboles, théorèmes etc
|
||||
|
||||
%%% On charge le paquet ifthen pout faire des tests
|
||||
\usepackage{ifthen}
|
||||
%%% On définit un compteur numérique pour l'année
|
||||
\newcounter{theyear}
|
||||
\setcounter{theyear}{\number\year}
|
||||
%%% Une macro pour écrire l'année académique automatiquement en
|
||||
%%% fonction du mois en cours
|
||||
\newcommand{\academicyear}[0]{
|
||||
\ifthenelse{\number\month<8}
|
||||
{\addtocounter{theyear}{-1}\arabic{theyear}\addtocounter{theyear}{-1999}\,-\arabic{theyear}}%
|
||||
{\arabic{theyear}\addtocounter{theyear}{-1999}\,-\arabic{theyear}}%
|
||||
}%
|
||||
|
||||
%%% mettre les macros à la racine du cours et ajuster en conséquence
|
||||
%%% pour éviter d'avoir plus d'une copie des macros par cours.
|
||||
%\input{MyMacros.tex}
|
||||
|
||||
%\input{SetColors.tex}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Def d'environement de Math (Malika)
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\theoremstyle{plain}
|
||||
\newtheorem*{theo}{Théorème}
|
||||
\newtheorem*{cons}{Conséquence}
|
||||
\newtheorem*{conss}{Conséquences}
|
||||
|
||||
|
||||
\theoremstyle{definition}
|
||||
\newtheorem{exo}{Exercice}
|
||||
\newtheorem*{defi}{Définition}
|
||||
\newtheorem*{probleme}{Problème}
|
||||
\newtheorem*{reponse}{Réponse}
|
||||
|
||||
|
||||
\theoremstyle{remark}
|
||||
\newtheorem*{exemple}{Exemple}
|
||||
\newtheorem*{remarque}{Remarque}
|
||||
\newtheorem*{remarques}{Remarques}
|
||||
\newtheorem*{prop}{Propriété}
|
||||
\newtheorem*{props}{Propriétés}
|
||||
|
||||
%\pagestyle{fancy}
|
||||
\fancyhf{}
|
||||
\fancyhead{
|
||||
\begin{minipage}{16cm}
|
||||
\hspace{-2cm}
|
||||
Nom : \fbox{\begin{minipage}{6cm}\hfill\vspace{.7cm}\end{minipage}}
|
||||
\hfill
|
||||
Pr\'enom : \fbox{\begin{minipage}{4cm}\hfill\vspace{.7cm}\end{minipage}}
|
||||
\hfill
|
||||
Groupe : \fbox{\begin{minipage}{.7cm}\hfill\vspace{.7cm}\end{minipage}}
|
||||
\end{minipage}
|
||||
}
|
||||
\fancyfoot[C]{Page {\large\thepage}}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Quelques paquets gérant la correction / espace pour la reponse
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\usepackage{comment}
|
||||
%%% Pour afficher la correction et exclure les boites pour la reponse
|
||||
% \includecomment{correction}
|
||||
% \excludecomment{EspaceReponse}
|
||||
%%% Pour version cachant la correction et incluant l'espace pour la reponse
|
||||
\excludecomment{correction}
|
||||
\includecomment{EspaceReponse}
|
||||
|
||||
|
||||
%%%
|
||||
\begin{document}
|
||||
|
||||
\
|
||||
\vspace{.2cm}
|
||||
|
||||
{\small
|
||||
\noindent IUT Sénart-Fontainebleau, UPEC
|
||||
\hfill
|
||||
Florent Madelaine
|
||||
|
||||
\noindent DEV 2.3
|
||||
\hfill
|
||||
Luc Dartois
|
||||
|
||||
\noindent IUT Info 2A \hfill Luc Hernandez
|
||||
|
||||
\hfill\noindent\academicyear{}
|
||||
|
||||
}
|
||||
\vspace{.7cm}
|
||||
|
||||
\hrule
|
||||
\vspace{.3cm}
|
||||
|
||||
\begin{center}
|
||||
|
||||
{\textbf{\Large
|
||||
Quelques outils
|
||||
}}
|
||||
\vspace{.1cm}
|
||||
|
||||
\end{center}
|
||||
\vspace{.3cm}
|
||||
|
||||
\hrule
|
||||
\vspace{.3cm}
|
||||
|
||||
\section*{Préambule}
|
||||
Nous allons survoler certains outils qui sont particulièrement utiles
|
||||
pour travailler sur un projet.
|
||||
|
||||
Je ne vais pas revenir sur les outils de \textbf{gestion de version}. Je
|
||||
recommande très fortement l'utilisation de git (il y a le serveur
|
||||
gitea à l'IUT \url{https://dwarves.iut-fbleau.fr/gitiut}).
|
||||
|
||||
Il y a des alternatives comme svn, voir pour des choses
|
||||
simples lorsqu'on ne travaille pas avec des informaticiens, dropbox ou
|
||||
autre service similaire de cloud.
|
||||
De manière générale, l'excuse \og mon chat a mangé mon projet ce w.e.,
|
||||
je ne peux donc pas vous le rendre\fg{} n'est pas acceptable.
|
||||
|
||||
Il y a de nombreux outils libres assez pratiques, par exemple framapad
|
||||
\url{https://framapad.org/fr/} si vous souhaitez partager des idées à
|
||||
distance sous forme d'un petit texte.
|
||||
|
||||
Vous le savez peut-être mais il y a de nombreuses alternatives libres
|
||||
à des outils bien connus (et propriétaires) qui marchent aussi bien
|
||||
voir mieux. Voir par exemple ce site:
|
||||
\url{https://degooglisons-internet.org/fr/} et cette page pour une
|
||||
liste de service en ligne
|
||||
\url{https://degooglisons-internet.org/fr/list}.
|
||||
|
||||
Aujourd'hui nous allons entrevoir deux outils :
|
||||
\begin{enumerate}
|
||||
\item le premier est un outil pour faire du suivi de projet (remplace
|
||||
le tableau physique du projet agile).
|
||||
\item le second est un logiciel permettant de rédiger de jolis
|
||||
rapports, voir de faire des présentations.
|
||||
\end{enumerate}
|
||||
|
||||
|
||||
\section*{Outil de suivi de projet}
|
||||
Quand on travaille sur un projet à plusieurs (et même parfois seul),
|
||||
il est important de pouvoir faire le point sur ce qu'on doit faire.
|
||||
Il y a un outil non libre qui s'appelle trello que je vous recommande
|
||||
dans l'immédiat.
|
||||
|
||||
Une bonne alternative libre est \url{https://kanboard.org/} mais je ne
|
||||
trouve plus de serveur accessible gratuitement. En attendant que nous
|
||||
l'offrons au département, je vous invite à utiliser trello.
|
||||
|
||||
L'avantage de kanvoard est qu'il permet de faire des diagrammes de
|
||||
Gantt, fonctionalité a priori non disponible sur trello.
|
||||
|
||||
\section*{\LaTeX}
|
||||
|
||||
Il s'agit d'une alternative populaire chez les scientifiques pour
|
||||
rédiger des documents (lettre, notes de cours, articles de recherche,
|
||||
rapports, livres) voir même faire des présentations ou des posters.
|
||||
|
||||
Le projet initial, \TeX, est initié par Donald Knuth\footnotemark{}
|
||||
\footnotetext{voir \url{https://en.wikipedia.org/wiki/Donald_Knuth}.}
|
||||
un pionnier de l'informatique.
|
||||
|
||||
Pour l'instant le logiciel n'est pas installé à l'IUT mais vous pouvez
|
||||
en attendant l'installez chez vous (voir
|
||||
\url{https://www.tug.org/texlive/acquire-netinstall.html}) ou dans
|
||||
l'immédiat pour aujourd'hui utiliser un serveur avec une interface web
|
||||
qui permet même de collaborer sur un même document.
|
||||
|
||||
\begin{yellow}
|
||||
\begin{exo}
|
||||
\begin{enumerate}
|
||||
\item
|
||||
Créez un compte sur \url{https://www.overleaf.com/about}.
|
||||
\item Créez un nouveau projet (en partant d'un exemple).
|
||||
\item Générez le pdf.
|
||||
\end{enumerate}
|
||||
\end{exo}
|
||||
\end{yellow}
|
||||
|
||||
Dans l'esprit, le \LaTeX ressemble au html.
|
||||
Le code est compilé pour produire un document (à l'origine du
|
||||
postcript, maintenant avec pdfLatex, du pdf).
|
||||
|
||||
Si vous souhaitez vous former, vous pouvez par exemple regarder ce
|
||||
wikibook : \url{https://en.wikibooks.org/wiki/LaTeX}.
|
||||
|
||||
Avec assez peu d'efforts, il est facile de faire un rapport avec des
|
||||
sections, un index, quelques images et une bibliographie.
|
||||
|
||||
Vous pouvez même faire des présentations de très belle qualité avec
|
||||
beamer. Le serveur overleaf contient de nombreux template.
|
||||
Dans l'immédiat je vous invite quand même à utiliser des choses très
|
||||
simples.
|
||||
|
||||
\begin{yellow}
|
||||
\begin{exo}
|
||||
Créez un squelette de rapport avec \LaTeX{} comportant un titre,
|
||||
un résumé, une table des matières, une figure.
|
||||
|
||||
Dans un second temps, si ce n'est pas déjà fait, chargez les
|
||||
paquets avec les bonnes options permettant de rédiger un tete en
|
||||
Français avec une gestion des accents, de la ponctuation etc.
|
||||
|
||||
Ensuite, ajoutez une table des figures et un index (glossaire)
|
||||
de termes techniques.
|
||||
|
||||
Ensuite ajoutez une jolie formule de math (avec des fractions et
|
||||
des sommes ou des intégrales).
|
||||
|
||||
Finalement, changez les fontes par défaut en allant voir le
|
||||
catalogue ici \url{https://tug.org/FontCatalogue/allfonts.html}.
|
||||
\end{exo}
|
||||
\end{yellow}
|
||||
|
||||
De manière générale, il ne faut pas chercher à détourner \LaTeX{} de
|
||||
ce qu'il souhaite faire. Le but de ce logiciel est de faire de la mise
|
||||
en page automatiquement. Si vous souhaitez faire de la mise en page
|
||||
très précise (comme dans un journal par exemple) alors \LaTeX{} n'est
|
||||
pas adapté.
|
||||
\end{document}
|
||||
|
||||
```
|
||||
|
||||
## Documenter votre code
|
||||
|
||||
Il existe des outils qui fonctionnent pour n'importe quel langage comme [doxygen](https://doxygen.nl/).
|
||||
|
||||
Pour java, en général on utilise [javadoc](https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html).
|
||||
|
||||
NB : certains éditeurs (par exemple sublimetext) génèrent à la volée une ébauche de documentation pour chaque méthode, chaque classe.
|
||||
|
||||
La commande `javadoc -d doc` permet de générer la documentation au format html dans le style de la documentation java que vous utilisez. En paramètre, vous pouvez donner des fichiers java.
|
||||
|
||||
## Organisation d'un projet
|
||||
|
||||
On va normalement avoir plusieur répertoires.
|
||||
* `src` pour les sources (les `.java`)
|
||||
* `doc` pour la documentation
|
||||
* `test` pour les tests
|
||||
* `build` pour les exécutables (les `.class`)
|
||||
|
||||
À la racine un `README` expliquant brièvement l'architecture du projet et comment déployer / utiliser le travail du projet.
|
||||
On ajoute aussi normalement une licence, par exemple [creative commons](https://creativecommons.org/about/cclicenses/).
|
||||
|
||||
Quand on a beaucoup de fichiers java on va avoir plusieurs paquets.
|
||||
On verra ça en détail en seconde année.
|
||||
|
||||
On propose normalement une méthode pour compiler les sources efficacement et générer un exécutable.
|
||||
En java souvent on va générer un `jar` (c'est juste une archive zip spéciale contenant les exécutable)
|
||||
|
||||
On peut par exemple utiliser `make` ou encore un script en shell.
|
||||
|
||||
On verra ceci plus tard, mais il existe aussi des outils plus récents, souvent bien intégrés aux IDE permettant de faire du déploiement continu (maven, gradle).
|
||||
|
||||
|
||||
|
328
TestsUnitaires/4TPGit.md
Normal file
328
TestsUnitaires/4TPGit.md
Normal file
@@ -0,0 +1,328 @@
|
||||
# Contrôle de version avec Git
|
||||
|
||||
[Git](https://fr.wikipedia.org/wiki/Git) permet de faire du contrôle de version. La différence avec d'autres systèmes de gestion de version est son aspect distribué et son système de branche.
|
||||
|
||||
La première partie de ce document ressemble beaucoup à l'introduction à Git que vous avez normalement eu en APL.
|
||||
Vous pouvez la relire très rapidement.
|
||||
De manière générale, le [site officiel](https://git-scm.com/about) est une excellente source d'information.
|
||||
|
||||
La seconde partie contient plus de détails et des exercices pour aller plus loin, en particulier, comment à travailler à plusieur et une introduction aux branches, qui est un aspect majeur de git.
|
||||
|
||||
Tout au long de ce TP, je vous invite à conserver une petite feuille de papier ou un fichier texte dans lequel prendre des notes pour lister chaque commande de git et une description indiquant à quoi elle sert.
|
||||
|
||||
À la fin de ce TP vous avez un quizz et une fin cocasse pour vous motiver à aller jusqu'au bout.
|
||||
|
||||
## digressions : rsync
|
||||
|
||||
Notez que si vous travaillez seul, et si vous souhaitez juste synchroniser des arborescences il existe la commande 'rsync'.
|
||||
|
||||
Du temps ancestral d'avant dropbox et autre client de nuage, pour travailler seul sans home sur un serveur mais sur plusieurs machines, il existait 'rsync' une commande qui permet de synchroniser une arborescence manuellement ou régulièrement et automatiquement avec un démon.
|
||||
|
||||
Il s'agit de 'green IT' avant l'heure puisque rsync ne va pas transmettre intégralement la nouvelle version de l'arborescence mais va envoyer en gros seulement les petites différences de chaque fichier.
|
||||
|
||||
Inconvénient par rapport à git : on ne peut pas revenir à une version antérieure.
|
||||
Avantage par rapport à git : potentiellement beaucoup moins gourmand en bande passante.
|
||||
|
||||
## Git
|
||||
Pour rappel, nous avons un serveur git au département
|
||||
['https://dwarves.iut-fbleau.fr/gitiut/'](https://dwarves.iut-fbleau.fr/gitiut/)
|
||||
|
||||
Rendez-vous sur la page d'accueil de Gitea et identifiez-vous.
|
||||
NB : ce service acceptera les mêmes identifiants que les machines virtuelles proxmox.
|
||||
|
||||
Pour éviter de saisir votre identifiant et votre mot de passe à chaque fois que vous transmettez
|
||||
une commande au serveur, je vous invite à suivre les étapes ci-dessous, si ce n'est pas déjà fait.
|
||||
|
||||
Une fois identifié accédez aux paramètres de votre compte et mettez à jour le nom complet
|
||||
et l'adresse e-mail principale. Nous allons nous assurer que `git` sur votre
|
||||
machine et `Gitea` sur le serveur ont bien les mêmes informations. Dans un
|
||||
terminal lancez les commandes suivantes (en utilisant les mêmes informations que sur `Gitea`):
|
||||
|
||||
|
||||
```
|
||||
git config --global user.name "Votre nom"
|
||||
git config --global user.email "login@domaine.example"
|
||||
git config --global core.editor vim
|
||||
```
|
||||
|
||||
NB. si vous voulez utiliser un autre éditeur, vous pouvez tout à fait remplacer 'vim' par 'emacs' ci-dessus.
|
||||
(trivia voir [editor war](https://en.wikipedia.org/wiki/Editor_war)). C'est l'éditeur qui sera choisi en cas de besoin par git, par exemple si vous faites un 'commit' sans donner l'option '-m "un message"' git vous demandera d'éditer le message en lançant un éditeur.
|
||||
Il vaut mieux donc choisir un éditeur que vous maitrisez un minimum.
|
||||
|
||||
Pour sécuriser les échanges entre votre machine et le serveur, il va vous falloir une
|
||||
paire de *clés de cryptage*. Tapez la commande suivante et validez sans entrer de
|
||||
réponse si des questions vous sont posées :
|
||||
|
||||
```
|
||||
ssh-keygen -t rsa -C "login@domaine.example"
|
||||
```
|
||||
|
||||
Ceci a créé parmi vos fichiers une clé privée et une clé publique. Nous devons maintenant
|
||||
donner la clé publique à `Gitea`. Commençons par afficher la clé publique :
|
||||
|
||||
```
|
||||
cat .ssh/id_rsa.pub
|
||||
```
|
||||
|
||||
Vous pouvez copier cette clé en la sélectionnant à la souris (aucun raccourci clavier
|
||||
n'est nécessaire). Revenez ensuite dans le navigateur et parmi les paramètres de votre
|
||||
compte `Gitea`, choisissez *Clés SSH*. Cliquez sur *Ajouter une Clé* puis copiez la clé dans la boîte *Contenu*
|
||||
(en appuyant sur la molette de la souris).
|
||||
Choisissez le nom que vous voulez pour la clé (vous pouvez par exemple l'appeler *TP* si c'est la clé générée dans
|
||||
une machine des salles de TP).
|
||||
|
||||
|
||||
## Création d'un dépôt en ligne
|
||||
|
||||
Chaque projet auquel vous participez doit avoir un dépôt dédié (et même plusieurs,
|
||||
comme nous le verrons par la suite). Vous pouvez aussi avoir un dépôt dédié pour chaque cours, surtout si il y a des TPs.
|
||||
|
||||
Créez un nouveau dépôt en utilisant le bouton qui ressemble à un '+'.
|
||||
|
||||
Si c'est un projet, il faut probablement suivre une convention de nommage pour que le correcteur retrouve le projet facilement.
|
||||
Rendez-le *privé*. Donnez les accès adaptés au(x) correteur(s) et aux autre(s) membre(s) de votre projet.
|
||||
|
||||
Dans la catégorie '.gitignore' vous pouvez choisir plusieurs modèles en fonction de votre projet et du type de fichiers qu'il va contenir
|
||||
(ou plus exactement de ceux que vous ne souhaitez pas sauvegarder).
|
||||
|
||||
Vous pouvez ensuite valider et constater que vous avez un dépôt contenant deux fichiers
|
||||
1. un fichier texte pour la license
|
||||
2. un fichier texte 'readme.md' qui devra à terme contenir un bref descriptif de l'architecture de votre projet.
|
||||
|
||||
Le dépôt en ligne est prêt et vous n'avez plus vraiment besoin d'accéder à `Gitea` par son interface web à partir de maintenant.
|
||||
|
||||
## Cloner un dépôt localement
|
||||
|
||||
Pour cloner un dépôt localement sur votre machine, il vous suffit de regarder son adresse sur un serveur git et d'y avoir accès.
|
||||
|
||||
Par exemple, pour le dépôt du projet 'PouetPouet' de l'utilisateur 'toto' sur le serve"ur git de l'iut, il faut saisir
|
||||
|
||||
```
|
||||
git clone gitea@dwarves.iut-fbleau.fr:toto/PouetPouet.git
|
||||
```
|
||||
Si il s'agit de votre dépôt que vous venez de crééer, vous allez voir si vous regardez tous les fichiers y compris les fichiers cachés (par exemple en faisant `ls -a`) :
|
||||
* un répertoire '.git'
|
||||
* un fichier texte '.gitignore'
|
||||
* un fichier texte en markdown 'README.md'
|
||||
|
||||
|
||||
Le dépôt local à proprement parler est dans le répertoire `.git`.
|
||||
Vous n'avez pas besoin de le visiter, mais vous pouvez y jeter un coup d'oeil si vous êtes curieux.
|
||||
Le répertoire `PouetPouet` est le répertoire de la copie de travail des fichiers du dépôt.
|
||||
|
||||
Attention : il faut éviter de cloner un dépôt git dans un dépôt git.
|
||||
C'est possible de le faire, mais c'est un [mécanisme avancé de git](http://git-scm.com/book/en/v2/Git-Tools-Submodules).
|
||||
|
||||
## Alternative : créer un dépôt local et le pousser dans un dépôt distant vide.
|
||||
|
||||
Alternativement, vous pouvez utiliser `git init` pour créer un dépôt local.
|
||||
Ensuite il faut utiliser `git add` et `git commit` pour indexer des fichiers puis faire un point de sauveguarde local (comme expliqué ci-dessus).
|
||||
|
||||
Ensuite `git remote add origin` suivi de l'url du dépôt sur le serveur
|
||||
(NB : origin est le nom que git donne au dépôt du serveur distant par défaut; il est parfois possible d'avoir plusieurs dépôts distants)
|
||||
pour indiquer le nom du dépôt distant.
|
||||
|
||||
Finalement il faut faire `git push -u -f origin master`.
|
||||
(NB : master est le nom de la branche principale, ici celle du dépôt local, l'option -u va éviter d'avoir à répéter origin et master par la suite dans les commandes).
|
||||
|
||||
___
|
||||
|
||||
# Utiliser Git au quotidien.
|
||||
|
||||
Dans cette partie nous illustrons l'usage de git à travers quelques exemples et exercices.
|
||||
|
||||
## Git en local
|
||||
L'utilisation de base pour un travail seul en local avec git sans sauvegarde distante est la suivante :
|
||||
|
||||
* travail sur un fichier local `monFichier`
|
||||
* ajout de ce fichier local dans l'index (`git add`)
|
||||
* point de sauveguarde (`git commit`)
|
||||
|
||||
### Exemple
|
||||
|
||||
```shell
|
||||
emacs monFichier
|
||||
git add monFichier
|
||||
git commit -m "un message court expliquant le changement de monFichier
|
||||
```
|
||||
|
||||
Si vous travaillez seulement en local, ceci suffit à avoir un sytème de version permettant de *revenir en arrière*.
|
||||
|
||||
Pour revenir en arrière sur 1 fichier il faut utiliser `git restore`.
|
||||
En option vous indiquez la version `-- source <le numéro de version>` puis `monFichier`
|
||||
(NB. c'est l'analogue d'un rollback de base de données).
|
||||
|
||||
Pour connaître le numéro d'une version, vous pouvez utiliser `git log`.
|
||||
|
||||
Si vous êtes un peu perdu `git status` donne beaucoup d'information et suggère des commandes.
|
||||
Vous pouvez lire le man sur ces commandes ou regardez les docs en ligne.
|
||||
|
||||
Remarque : 'git restore' est relativement récent et avant il y avait 'git checkout'.
|
||||
Cette seconde commande a beaucoup d'usage, ce qui contrevient à l'esprit unix une commande pour un usage.
|
||||
Sauf si vous maîtrisez bien 'git checkout', mieux vaut utiliser les divers nouvelles commandes qui la remplacent
|
||||
comme 'git restore' et 'git switch'.
|
||||
|
||||
|
||||
### Exercice
|
||||
|
||||
* éditez un nouveau fichier `Git.md`.
|
||||
* y insérer le contenu ci-dessous.
|
||||
|
||||
Git is a term of insult denoting an unpleasant, silly, incompetent, annoying, senile, elderly or childish person.
|
||||
As a mild oath it is roughly on a par with prat and marginally less pejorative than berk. Typically a
|
||||
good-natured admonition with a strong implication of familiarity, git is more severe than twit or idiot
|
||||
but less severe than wanker, arsehole or twat when offence is intended.
|
||||
|
||||
* sauver le fichier.
|
||||
* saisir `git status`
|
||||
* indexer ce fichier.
|
||||
* créer un point de sauveguarde avec le message "git definition"
|
||||
* saisir `git log`
|
||||
|
||||
En cette période de jubilée de platine de sa majesté, il est difficile de laisser visible un tel texte.
|
||||
Nous allons maintenant faire un nouveau point de sauveguarde après avoir transformé le contenu du fichier en rot13.
|
||||
|
||||
* pour faire rot13 vous pouvez utiliser `cat Git.md | tr 'A-Za-z' 'N-ZA-Mn-za-m'`
|
||||
* Ensuite refaites un nouveau point de sauveguarde avec le message "vg qrsvavgvba".
|
||||
|
||||
Le jubilé étant passé et Bojo étant toujours premier ministre, on décide de revenir à la version antérieure.
|
||||
|
||||
* restorer le contenu du fichier `Git.md`.
|
||||
|
||||
## Git en local et sur serveur distant.
|
||||
|
||||
Avec un serveur distant, vous pouvez normalement garantir de conserver tout votre travail qui est sauvé sur le serveur git, même si votre ordinateur personnel vous lâche.
|
||||
|
||||
Si vous avez plusieurs machines / comptes, il faut faire un `git pull` pour récupérer la version du serveur.
|
||||
|
||||
Ensuite vous travaillez en local comme ci-dessus (cycle édition, `git add`, `git commit`).
|
||||
|
||||
Dès que vous voulez sauver sur le serveur, il faut faire un `git push`.
|
||||
|
||||
Remarque : vous n'êtes pas obligé de faire un push pour chaque commit local.
|
||||
Le commit local sert à faire des undo alors que le push sert à montrer des changements relativement conséquents (potentiellement utile pour d'autres lecteurs que vous le jour où vous travaillez à plusieurs).
|
||||
Voir [cette question](https://stackoverflow.com/questions/10565217/do-you-push-every-single-commit) pour plus de détails.
|
||||
|
||||
### Exercice
|
||||
|
||||
* On reprend l'exercice précadent avec un fichier 'Git2.md' contenant 2 lignes de plus que précédemment.
|
||||
|
||||
Git is a term of insult denoting an unpleasant, silly, incompetent, annoying, senile, elderly or childish person.
|
||||
As a mild oath it is roughly on a par with prat and marginally less pejorative than berk. Typically a
|
||||
good-natured admonition with a strong implication of familiarity, git is more severe than twit or idiot
|
||||
but less severe than wanker, arsehole or twat when offence is intended.
|
||||
|
||||
The term is used by Graham Chapman in the Monty Python sketch "Argument Clinic".
|
||||
|
||||
The term is also frequently used by the character Derek 'Del Boy' Trotter in TV series Only Fools and Horses.
|
||||
|
||||
* indexer le fichier, sauver le fichier, faire un commit local.
|
||||
* faire du rot13, indexer, sauver le fichier, faire un commit local.
|
||||
* faire un push
|
||||
* saisir `git log` en local
|
||||
* allez voir les révisions sur l'interface web de gitea
|
||||
* faites un restore en local.
|
||||
* regardez si il y a des effets sur le dépôt local.
|
||||
* regardez si il y a des effets sur le dépôt distant via l'interace web.
|
||||
|
||||
## Nous travaillons à deux
|
||||
|
||||
Vous n'êtes pas obligé de travailler à deux pour cet exercice, ni même d'avoir deux machines clientes.
|
||||
Vous pouvez simuler la seconde personne en vous mettant dans un autre répertoire sur votre machine et en y clonant le dépôt.
|
||||
|
||||
Dans cet exercice nous simulons un conflit de version sur un fichier.
|
||||
En gros vous faites un `git push` et le message vous indique qu'il y a un conflit et comment le résoudre.
|
||||
Il faut faire un `git pull`. Git essaye de faire la fusion automatique et vous indique un conflit.
|
||||
Vous devez éditer le fichier qui contient maintenant très clairement les lignes divergentes de l'autre version.
|
||||
Vous faites votre selection, sauvez le fichier, l'indexer, commit puis pousser le changement.
|
||||
|
||||
Normalement ceci fonctionne assez bien pour des choses simples, en particulier si vous changez des lignes différentes d'un fichier.
|
||||
|
||||
### Exercice
|
||||
* Ajouter les fichier du TP noté 'Memoire.java' et 'MaMemoire.java' (dans l'archive `Shadockv0.zip` sur `BUT1-Test-Public/`).
|
||||
* Les indexer
|
||||
* Faire un commit
|
||||
* pousser sur origin
|
||||
* Donner accès en écriture à un collègue.
|
||||
|
||||
En parallèle sur vos machines respectives
|
||||
* Le premier corrige les bugs de 'add' et 'contain' (avec commentaire BUGFIX etc).
|
||||
* indexer, commit.
|
||||
|
||||
* Le second procède de même sur 'remove' et 'size'.
|
||||
|
||||
Puis dans cet ordre:
|
||||
* Le second pousse.
|
||||
* Le premier essaye de pousser.
|
||||
* Le premier résoud le conflit en faisant
|
||||
* un `git pull`,
|
||||
* édition de `MaMemoire.java` pour avoir bien version cohérente du fichier appliquant les changements des 2 personnes
|
||||
* un `git add`, `git commit` puis un `git push`
|
||||
|
||||
L'étape d'édition est probablement inutile si vous avez changé des lignes différentes du fichier.
|
||||
|
||||
### Exercice
|
||||
|
||||
Reprendre l'exo précédent, mais cette fois ajoutez chacun des changements sur des lignes communes.
|
||||
Par exemple vous changez chacun la javadoc de la même méthode ou bien vous changez le nom de la même variable dans la même méthode.
|
||||
Normalement la résolution automatique du conflit et la fusion des fichiers va échouer et vous allez être obligé de faire la fusion manuelle.
|
||||
|
||||
|
||||
## Les branches
|
||||
|
||||
La spécificité de git par rapport à d'autres système de contrôle de versions est que git encourage très fortement l'utilisation très fréquente de branches et que sous le capot il s'agit de quelque chose d'assez léger.
|
||||
|
||||
Pour fabriquer une branche, on va faire
|
||||
`git branch LeNomDeMaBranche`
|
||||
Pour changer de branche, on peut utiliser `git checkout` mais je vous recommande la commande plus moderne qui ne sert qu'à changer de branche qui s'appelle `git switch`.
|
||||
Par exemple, pour basculer sur cette branche qu'on vient de créer, on va faire
|
||||
`git switch LeNomDeMaBranche`
|
||||
|
||||
Notez que vous aviez avant d'ajouter cette nouvelle branche, une branche par défaut qui se nomme `master`.
|
||||
|
||||
Dans la suite je vais supposer que chaque branche est dans un état propre, à savoir tous les fichiers utiles ou changés sont indexés (`git add`) et il y a un point de sauveguarde local (`git commit`).
|
||||
Ceci permet de ne jamais perdre son travail quand on bascule de branche en branche.
|
||||
|
||||
Vous pouvez changer à tout moment de branche avec `git switch`.
|
||||
|
||||
Pour fusionner le travail d'une branche dans une autre branche, il faut vous placer dans la branche dans laquelle vous souhaiter injecter le changement et utiliser `git merge`.
|
||||
Par exemple, pour insérer les changements de `LeNomDeMaBranche` dans `master` il faut juste faire :
|
||||
|
||||
```git
|
||||
git switch master
|
||||
git merge LeNomDeMaBranche
|
||||
```
|
||||
|
||||
Si `LeNomDeMaBranche` est juste un successeur de `master` la fusion est très simple pour git puisque c'est juste du déplacement de pointeur (en gros `master` va pointer sur `LeNomDeMaBranche`).
|
||||
Dans son jargon, git évoquera un `fast-forward`.
|
||||
Si au contraire `LeNomDeMaBranche` et `master` on un ancêtre commun car il y a eu des changements dans la branche principale `master` depuis que la branche ``LeNomDeMaBranche` a poussé, alors la fusion est un peu plus compliquée à mettre en oeuvre, mais pourra probablement être faite automatiquement.
|
||||
Dans son jargon, git évoquera un `three-way merge`.
|
||||
Si git n'arrive pas à résoudre tout automatiquement, alors il va évoquer un `merge conflict`. Vous pouvez utiliser `git status`, changer à la main ce qu'il faut.
|
||||
|
||||
Si vous avez intégré le travail d'une branche qui ne sert maintenant plus à rien, vous pouvez l'effacer en faisant :
|
||||
`git branch -d LeNomDeMaBranche`
|
||||
Attention : ce n'est pas quelque chose qu'on peut annuler
|
||||
|
||||
Le livre en ligne sur le site de git (disponible en plusieurs langues dont le français) est très bien fait et vous pouvez avoir plus de détails en regardant (ici)[https://git-scm.com/book/fr/v2/Les-branches-avec-Git-Les-branches-en-bref] et (la)[https://git-scm.com/book/fr/v2/Les-branches-avec-Git-Branches-et-fusions%C2%A0%3A-les-bases].
|
||||
|
||||
|
||||
# Pour aller plus loin.
|
||||
|
||||
## Fin cocasse
|
||||
|
||||
[Jeu en javascript pour s'entraîner](https://learngitbranching.js.org/)
|
||||
|
||||
|
||||
## Quizz
|
||||
|
||||
1. Qui a commencé le développement de git?
|
||||
2. Comment les fichiers d'un dépôt git sont-ils indexés?
|
||||
3. Faut il un serveur git centralisé?
|
||||
4. Quelle commande permet-elle d'indexer un fichier?
|
||||
5. Quelle commande permet-elle de récupérer le dernier point de sauvegarde depuis le dépôt distant?
|
||||
6. Que veut dire 'origin' dans le contexte de 'git'?
|
||||
7. Que veut dire 'master' dans le contexte de 'git'?
|
||||
8. Quelle commande permet-elle de transmettre le dernier point de sauvegarde dans le dépôt distant?
|
||||
9. Comment connaître le nom des points de sauvegarde?
|
||||
10. Comment savoir où on en est quand on ne sait plus trop quoi faire?
|
||||
11. What is the difference between a git and a plonker?
|
BIN
TestsUnitaires/Junit4Exemples.tar.gz
Normal file
BIN
TestsUnitaires/Junit4Exemples.tar.gz
Normal file
Binary file not shown.
493
TestsUnitaires/LICENSE
Normal file
493
TestsUnitaires/LICENSE
Normal file
@@ -0,0 +1,493 @@
|
||||
CeCILL FREE SOFTWARE LICENSE AGREEMENT
|
||||
|
||||
Version 2.1 dated 2013-06-21 Notice
|
||||
|
||||
This Agreement is a Free Software license agreement that is the result of
|
||||
discussions between its authors in order to ensure compliance with the two
|
||||
main principles guiding its drafting:
|
||||
|
||||
* firstly, compliance with the principles governing the distribution of Free
|
||||
Software: access to source code, broad rights granted to users,
|
||||
|
||||
* secondly, the election of a governing law, French law, with which it is
|
||||
conformant, both as regards the law of torts and intellectual property law,
|
||||
and the protection that it offers to both authors and holders of the economic
|
||||
rights over software.
|
||||
|
||||
The authors of the CeCILL¹ license are:
|
||||
|
||||
|
||||
|
||||
Commissariat à l'énergie atomique et aux énergies alternatives - CEA, a public
|
||||
scientific, technical and industrial research establishment, having its principal
|
||||
place of business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France.
|
||||
|
||||
|
||||
|
||||
Centre National de la Recherche Scientifique - CNRS, a public scientific and
|
||||
technological establishment, having its principal place of business at 3 rue
|
||||
Michel-Ange, 75794 Paris cedex 16, France.
|
||||
|
||||
|
||||
|
||||
Institut National de Recherche en Informatique et en Automatique - Inria,
|
||||
a public scientific and technological establishment, having its principal
|
||||
place of business at Domaine de Voluceau, Rocquencourt, BP 105, 78153 Le Chesnay
|
||||
cedex, France.
|
||||
|
||||
Preamble The purpose of this Free Software license agreement is to grant users
|
||||
the right to modify and redistribute the software governed by this license
|
||||
within the framework of an open source distribution model.
|
||||
|
||||
The exercising of this right is conditional upon certain obligations for users
|
||||
so as to preserve this status for all subsequent redistributions.
|
||||
|
||||
In consideration of access to the source code and the rights to copy, modify
|
||||
and redistribute granted by the license, users are provided only with a limited
|
||||
warranty and the software's author, the holder of the economic rights, and
|
||||
the successive licensors only have limited liability.
|
||||
|
||||
In this respect, the risks associated with loading, using, modifying and/or
|
||||
developing or reproducing the software by the user are brought to the user's
|
||||
attention, given its Free Software status, which may make it complicated to
|
||||
use, with the result that its use is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore encouraged
|
||||
to load and test the suitability of the software as regards their requirements
|
||||
in conditions enabling the security of their systems and/or data to be ensured
|
||||
and, more generally, to use and operate it in the same conditions of security.
|
||||
This Agreement may be freely reproduced and published, provided it is not
|
||||
altered, and that no provisions are either added or removed herefrom.
|
||||
|
||||
This Agreement may apply to any or all software for which the holder of the
|
||||
economic rights decides to submit the use thereof to its provisions.
|
||||
|
||||
Frequently asked questions can be found on the official website of the CeCILL
|
||||
licenses family (http://www.cecill.info/index.en.html) for any necessary clarification.
|
||||
|
||||
Article 1 - DEFINITIONS
|
||||
|
||||
For the purpose of this Agreement, when the following expressions commence
|
||||
with a capital letter, they shall have the following meaning:
|
||||
|
||||
|
||||
|
||||
Agreement: means this license agreement, and its possible subsequent versions
|
||||
and annexes.
|
||||
|
||||
|
||||
|
||||
Software: means the software in its Object Code and/or Source Code form and,
|
||||
where applicable, its documentation, "as is" when the Licensee accepts the
|
||||
Agreement.
|
||||
|
||||
|
||||
|
||||
Initial Software: means the Software in its Source Code and possibly its Object
|
||||
Code form and, where applicable, its documentation, "as is" when it is first
|
||||
distributed under the terms and conditions of the Agreement.
|
||||
|
||||
|
||||
|
||||
Modified Software: means the Software modified by at least one Contribution.
|
||||
|
||||
|
||||
|
||||
Source Code: means all the Software's instructions and program lines to which
|
||||
access is required so as to modify the Software.
|
||||
|
||||
|
||||
|
||||
Object Code: means the binary files originating from the compilation of the
|
||||
Source Code.
|
||||
|
||||
|
||||
|
||||
Holder: means the holder(s) of the economic rights over the Initial Software.
|
||||
|
||||
|
||||
|
||||
Licensee: means the Software user(s) having accepted the Agreement.
|
||||
|
||||
|
||||
|
||||
Contributor: means a Licensee having made at least one Contribution.
|
||||
|
||||
|
||||
|
||||
Licensor: means the Holder, or any other individual or legal entity, who distributes
|
||||
the Software under the Agreement.
|
||||
|
||||
|
||||
|
||||
Contribution: means any or all modifications, corrections, translations, adaptations
|
||||
and/or new functions integrated into the Software by any or all Contributors,
|
||||
as well as any or all Internal Modules.
|
||||
|
||||
|
||||
|
||||
Module: means a set of sources files including their documentation that enables
|
||||
supplementary functions or services in addition to those offered by the Software.
|
||||
|
||||
|
||||
|
||||
External Module: means any or all Modules, not derived from the Software,
|
||||
so that this Module and the Software run in separate address spaces, with
|
||||
one calling the other when they are run.
|
||||
|
||||
|
||||
|
||||
Internal Module: means any or all Module, connected to the Software so that
|
||||
they both execute in the same address space.
|
||||
|
||||
|
||||
|
||||
GNU GPL: means the GNU General Public License version 2 or any subsequent
|
||||
version, as published by the Free Software Foundation Inc.
|
||||
|
||||
|
||||
|
||||
GNU Affero GPL: means the GNU Affero General Public License version 3 or any
|
||||
subsequent version, as published by the Free Software Foundation Inc.
|
||||
|
||||
|
||||
|
||||
EUPL: means the European Union Public License version 1.1 or any subsequent
|
||||
version, as published by the European Commission.
|
||||
|
||||
|
||||
|
||||
Parties: mean both the Licensee and the Licensor.
|
||||
|
||||
These expressions may be used both in singular and plural form.
|
||||
|
||||
Article 2 - PURPOSE
|
||||
|
||||
The purpose of the Agreement is the grant by the Licensor to the Licensee
|
||||
of a non-exclusive, transferable and worldwide license for the Software as
|
||||
set forth in Article 5 <#scope> hereinafter for the whole term of the protection
|
||||
granted by the rights over said Software.
|
||||
|
||||
Article 3 - ACCEPTANCE
|
||||
|
||||
3.1 The Licensee shall be deemed as having accepted the terms and conditions
|
||||
of this Agreement upon the occurrence of the first of the following events:
|
||||
|
||||
(i) loading the Software by any or all means, notably, by downloading from
|
||||
a remote server, or by loading from a physical medium;
|
||||
|
||||
(ii) the first time the Licensee exercises any of the rights granted hereunder.
|
||||
|
||||
3.2 One copy of the Agreement, containing a notice relating to the characteristics
|
||||
of the Software, to the limited warranty, and to the fact that its use is
|
||||
restricted to experienced users has been provided to the Licensee prior to
|
||||
its acceptance as set forth in Article 3.1 <#accepting> hereinabove, and the
|
||||
Licensee hereby acknowledges that it has read and understood it.
|
||||
|
||||
Article 4 - EFFECTIVE DATE AND TERM
|
||||
|
||||
4.1 EFFECTIVE DATE
|
||||
|
||||
The Agreement shall become effective on the date when it is accepted by the
|
||||
Licensee as set forth in Article 3.1 <#accepting> .
|
||||
|
||||
4.2 TERM
|
||||
|
||||
The Agreement shall remain in force for the entire legal term of protection
|
||||
of the economic rights over the Software.
|
||||
|
||||
Article 5 - SCOPE OF RIGHTS GRANTED
|
||||
|
||||
The Licensor hereby grants to the Licensee, who accepts, the following rights
|
||||
over the Software for any or all use, and for the term of the Agreement, on
|
||||
the basis of the terms and conditions set forth hereinafter.
|
||||
|
||||
Besides, if the Licensor owns or comes to own one or more patents protecting
|
||||
all or part of the functions of the Software or of its components, the Licensor
|
||||
undertakes not to enforce the rights granted by these patents against successive
|
||||
Licensees using, exploiting or modifying the Software. If these patents are
|
||||
transferred, the Licensor undertakes to have the transferees subscribe to
|
||||
the obligations set forth in this paragraph.
|
||||
|
||||
5.1 RIGHT OF USE
|
||||
|
||||
The Licensee is authorized to use the Software, without any limitation as
|
||||
to its fields of application, with it being hereinafter specified that this
|
||||
comprises:
|
||||
|
||||
1. permanent or temporary reproduction of all or part of the Software by any
|
||||
or all means and in any or all form.
|
||||
|
||||
2. loading, displaying, running, or storing the Software on any or all medium.
|
||||
|
||||
3. entitlement to observe, study or test its operation so as to determine
|
||||
the ideas and principles behind any or all constituent elements of said Software.
|
||||
This shall apply when the Licensee carries out any or all loading, displaying,
|
||||
running, transmission or storage operation as regards the Software, that it
|
||||
is entitled to carry out hereunder.
|
||||
|
||||
5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS
|
||||
|
||||
The right to make Contributions includes the right to translate, adapt, arrange,
|
||||
or make any or all modifications to the Software, and the right to reproduce
|
||||
the resulting software.
|
||||
|
||||
The Licensee is authorized to make any or all Contributions to the Software
|
||||
provided that it includes an explicit notice that it is the author of said
|
||||
Contribution and indicates the date of the creation thereof.
|
||||
|
||||
5.3 RIGHT OF DISTRIBUTION
|
||||
|
||||
In particular, the right of distribution includes the right to publish, transmit
|
||||
and communicate the Software to the general public on any or all medium, and
|
||||
by any or all means, and the right to market, either in consideration of a
|
||||
fee, or free of charge, one or more copies of the Software by any means.
|
||||
|
||||
The Licensee is further authorized to distribute copies of the modified or
|
||||
unmodified Software to third parties according to the terms and conditions
|
||||
set forth hereinafter.
|
||||
|
||||
5.3.1. DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION
|
||||
|
||||
The Licensee is authorized to distribute true copies of the Software in Source
|
||||
Code or Object Code form, provided that said distribution complies with all
|
||||
the provisions of the Agreement and is accompanied by:
|
||||
|
||||
1. a copy of the Agreement,
|
||||
|
||||
2. a notice relating to the limitation of both the Licensor's warranty and
|
||||
liability as set forth in Articles 8 and 9,
|
||||
|
||||
and that, in the event that only the Object Code of the Software is redistributed,
|
||||
the Licensee allows effective access to the full Source Code of the Software
|
||||
for a period of at least three years from the distribution of the Software,
|
||||
it being understood that the additional acquisition cost of the Source Code
|
||||
shall not exceed the cost of the data transfer.
|
||||
|
||||
5.3.2. DISTRIBUTION OF MODIFIED SOFTWARE
|
||||
|
||||
When the Licensee makes a Contribution to the Software, the terms and conditions
|
||||
for the distribution of the resulting Modified Software become subject to
|
||||
all the provisions of this Agreement.
|
||||
|
||||
The Licensee is authorized to distribute the Modified Software, in source
|
||||
code or object code form, provided that said distribution complies with all
|
||||
the provisions of the Agreement and is accompanied by:
|
||||
|
||||
1. a copy of the Agreement,
|
||||
|
||||
2. a notice relating to the limitation of both the Licensor's warranty and
|
||||
liability as set forth in Articles 8 and 9,
|
||||
|
||||
and, in the event that only the object code of the Modified Software is redistributed,
|
||||
|
||||
3. a note stating the conditions of effective access to the full source code
|
||||
of the Modified Software for a period of at least three years from the distribution
|
||||
of the Modified Software, it being understood that the additional acquisition
|
||||
cost of the source code shall not exceed the cost of the data transfer.
|
||||
|
||||
5.3.3. DISTRIBUTION OF EXTERNAL MODULES
|
||||
|
||||
When the Licensee has developed an External Module, the terms and conditions
|
||||
of this Agreement do not apply to said External Module, that may be distributed
|
||||
under a separate license agreement.
|
||||
|
||||
5.3.4. COMPATIBILITY WITH OTHER LICENSES
|
||||
|
||||
The Licensee can include a code that is subject to the provisions of one of
|
||||
the versions of the GNU GPL, GNU Affero GPL and/or EUPL in the Modified or
|
||||
unmodified Software, and distribute that entire code under the terms of the
|
||||
same version of the GNU GPL, GNU Affero GPL and/or EUPL.
|
||||
|
||||
The Licensee can include the Modified or unmodified Software in a code that
|
||||
is subject to the provisions of one of the versions of the GNU GPL, GNU Affero
|
||||
GPL and/or EUPL and distribute that entire code under the terms of the same
|
||||
version of the GNU GPL, GNU Affero GPL and/or EUPL.
|
||||
|
||||
Article 6 - INTELLECTUAL PROPERTY
|
||||
|
||||
6.1 OVER THE INITIAL SOFTWARE
|
||||
|
||||
The Holder owns the economic rights over the Initial Software. Any or all
|
||||
use of the Initial Software is subject to compliance with the terms and conditions
|
||||
under which the Holder has elected to distribute its work and no one shall
|
||||
be entitled to modify the terms and conditions for the distribution of said
|
||||
Initial Software.
|
||||
|
||||
The Holder undertakes that the Initial Software will remain ruled at least
|
||||
by this Agreement, for the duration set forth in Article 4.2 <#term> .
|
||||
|
||||
6.2 OVER THE CONTRIBUTIONS
|
||||
|
||||
The Licensee who develops a Contribution is the owner of the intellectual
|
||||
property rights over this Contribution as defined by applicable law.
|
||||
|
||||
6.3 OVER THE EXTERNAL MODULES
|
||||
|
||||
The Licensee who develops an External Module is the owner of the intellectual
|
||||
property rights over this External Module as defined by applicable law and
|
||||
is free to choose the type of agreement that shall govern its distribution.
|
||||
|
||||
6.4 JOINT PROVISIONS
|
||||
|
||||
The Licensee expressly undertakes:
|
||||
|
||||
1. not to remove, or modify, in any manner, the intellectual property notices
|
||||
attached to the Software;
|
||||
|
||||
2. to reproduce said notices, in an identical manner, in the copies of the
|
||||
Software modified or not.
|
||||
|
||||
The Licensee undertakes not to directly or indirectly infringe the intellectual
|
||||
property rights on the Software of the Holder and/or Contributors, and to
|
||||
take, where applicable, vis-à-vis its staff, any and all measures required
|
||||
to ensure respect of said intellectual property rights of the Holder and/or
|
||||
Contributors.
|
||||
|
||||
Article 7 - RELATED SERVICES
|
||||
|
||||
7.1 Under no circumstances shall the Agreement oblige the Licensor to provide
|
||||
technical assistance or maintenance services for the Software.
|
||||
|
||||
However, the Licensor is entitled to offer this type of services. The terms
|
||||
and conditions of such technical assistance, and/or such maintenance, shall
|
||||
be set forth in a separate instrument. Only the Licensor offering said maintenance
|
||||
and/or technical assistance services shall incur liability therefor.
|
||||
|
||||
7.2 Similarly, any Licensor is entitled to offer to its licensees, under its
|
||||
sole responsibility, a warranty, that shall only be binding upon itself, for
|
||||
the redistribution of the Software and/or the Modified Software, under terms
|
||||
and conditions that it is free to decide. Said warranty, and the financial
|
||||
terms and conditions of its application, shall be subject of a separate instrument
|
||||
executed between the Licensor and the Licensee.
|
||||
|
||||
Article 8 - LIABILITY
|
||||
|
||||
8.1 Subject to the provisions of Article 8.2, the Licensee shall be entitled
|
||||
to claim compensation for any direct loss it may have suffered from the Software
|
||||
as a result of a fault on the part of the relevant Licensor, subject to providing
|
||||
evidence thereof.
|
||||
|
||||
8.2 The Licensor's liability is limited to the commitments made under this
|
||||
Agreement and shall not be incurred as a result of in particular: (i) loss
|
||||
due the Licensee's total or partial failure to fulfill its obligations, (ii)
|
||||
direct or consequential loss that is suffered by the Licensee due to the use
|
||||
or performance of the Software, and (iii) more generally, any consequential
|
||||
loss. In particular the Parties expressly agree that any or all pecuniary
|
||||
or business loss (i.e. loss of data, loss of profits, operating loss, loss
|
||||
of customers or orders, opportunity cost, any disturbance to business activities)
|
||||
or any or all legal proceedings instituted against the Licensee by a third
|
||||
party, shall constitute consequential loss and shall not provide entitlement
|
||||
to any or all compensation from the Licensor.
|
||||
|
||||
Article 9 - WARRANTY
|
||||
|
||||
9.1 The Licensee acknowledges that the scientific and technical state-of-the-art
|
||||
when the Software was distributed did not enable all possible uses to be tested
|
||||
and verified, nor for the presence of possible defects to be detected. In
|
||||
this respect, the Licensee's attention has been drawn to the risks associated
|
||||
with loading, using, modifying and/or developing and reproducing the Software
|
||||
which are reserved for experienced users.
|
||||
|
||||
The Licensee shall be responsible for verifying, by any or all means, the
|
||||
suitability of the product for its requirements, its good working order, and
|
||||
for ensuring that it shall not cause damage to either persons or properties.
|
||||
|
||||
9.2 The Licensor hereby represents, in good faith, that it is entitled to
|
||||
grant all the rights over the Software (including in particular the rights
|
||||
set forth in Article 5 <#scope> ).
|
||||
|
||||
9.3 The Licensee acknowledges that the Software is supplied "as is" by the
|
||||
Licensor without any other express or tacit warranty, other than that provided
|
||||
for in Article 9.2 <#good-faith> and, in particular, without any warranty
|
||||
as to its commercial value, its secured, safe, innovative or relevant nature.
|
||||
|
||||
Specifically, the Licensor does not warrant that the Software is free from
|
||||
any error, that it will operate without interruption, that it will be compatible
|
||||
with the Licensee's own equipment and software configuration, nor that it
|
||||
will meet the Licensee's requirements.
|
||||
|
||||
9.4 The Licensor does not either expressly or tacitly warrant that the Software
|
||||
does not infringe any third party intellectual property right relating to
|
||||
a patent, software or any other property right. Therefore, the Licensor disclaims
|
||||
any and all liability towards the Licensee arising out of any or all proceedings
|
||||
for infringement that may be instituted in respect of the use, modification
|
||||
and redistribution of the Software. Nevertheless, should such proceedings
|
||||
be instituted against the Licensee, the Licensor shall provide it with technical
|
||||
and legal expertise for its defense. Such technical and legal expertise shall
|
||||
be decided on a case-by-case basis between the relevant Licensor and the Licensee
|
||||
pursuant to a memorandum of understanding. The Licensor disclaims any and
|
||||
all liability as regards the Licensee's use of the name of the Software. No
|
||||
warranty is given as regards the existence of prior rights over the name of
|
||||
the Software or as regards the existence of a trademark.
|
||||
|
||||
Article 10 - TERMINATION
|
||||
|
||||
10.1 In the event of a breach by the Licensee of its obligations hereunder,
|
||||
the Licensor may automatically terminate this Agreement thirty (30) days after
|
||||
notice has been sent to the Licensee and has remained ineffective.
|
||||
|
||||
10.2 A Licensee whose Agreement is terminated shall no longer be authorized
|
||||
to use, modify or distribute the Software. However, any licenses that it may
|
||||
have granted prior to termination of the Agreement shall remain valid subject
|
||||
to their having been granted in compliance with the terms and conditions hereof.
|
||||
|
||||
Article 11 - MISCELLANEOUS
|
||||
|
||||
11.1 EXCUSABLE EVENTS
|
||||
|
||||
Neither Party shall be liable for any or all delay, or failure to perform
|
||||
the Agreement, that may be attributable to an event of force majeure, an act
|
||||
of God or an outside cause, such as defective functioning or interruptions
|
||||
of the electricity or telecommunications networks, network paralysis following
|
||||
a virus attack, intervention by government authorities, natural disasters,
|
||||
water damage, earthquakes, fire, explosions, strikes and labor unrest, war,
|
||||
etc.
|
||||
|
||||
11.2 Any failure by either Party, on one or more occasions, to invoke one
|
||||
or more of the provisions hereof, shall under no circumstances be interpreted
|
||||
as being a waiver by the interested Party of its right to invoke said provision(s)
|
||||
subsequently.
|
||||
|
||||
11.3 The Agreement cancels and replaces any or all previous agreements, whether
|
||||
written or oral, between the Parties and having the same purpose, and constitutes
|
||||
the entirety of the agreement between said Parties concerning said purpose.
|
||||
No supplement or modification to the terms and conditions hereof shall be
|
||||
effective as between the Parties unless it is made in writing and signed by
|
||||
their duly authorized representatives.
|
||||
|
||||
11.4 In the event that one or more of the provisions hereof were to conflict
|
||||
with a current or future applicable act or legislative text, said act or legislative
|
||||
text shall prevail, and the Parties shall make the necessary amendments so
|
||||
as to comply with said act or legislative text. All other provisions shall
|
||||
remain effective. Similarly, invalidity of a provision of the Agreement, for
|
||||
any reason whatsoever, shall not cause the Agreement as a whole to be invalid.
|
||||
|
||||
11.5 LANGUAGE
|
||||
|
||||
The Agreement is drafted in both French and English and both versions are
|
||||
deemed authentic.
|
||||
|
||||
Article 12 - NEW VERSIONS OF THE AGREEMENT
|
||||
|
||||
12.1 Any person is authorized to duplicate and distribute copies of this Agreement.
|
||||
|
||||
12.2 So as to ensure coherence, the wording of this Agreement is protected
|
||||
and may only be modified by the authors of the License, who reserve the right
|
||||
to periodically publish updates or new versions of the Agreement, each with
|
||||
a separate number. These subsequent versions may address new issues encountered
|
||||
by Free Software.
|
||||
|
||||
12.3 Any Software distributed under a given version of the Agreement may only
|
||||
be subsequently distributed under the same version of the Agreement or a subsequent
|
||||
version, subject to the provisions of Article 5.3.4 <#compatibility> .
|
||||
|
||||
Article 13 - GOVERNING LAW AND JURISDICTION
|
||||
|
||||
13.1 The Agreement is governed by French law. The Parties agree to endeavor
|
||||
to seek an amicable solution to any disagreements or disputes that may arise
|
||||
during the performance of the Agreement.
|
||||
|
||||
13.2 Failing an amicable solution within two (2) months as from their occurrence,
|
||||
and unless emergency proceedings are necessary, the disagreements or disputes
|
||||
shall be referred to the Paris Courts having jurisdiction, by the more diligent
|
||||
Party. 1 CeCILL stands for Ce(a) C(nrs) I(nria) L(ogiciel) L(ibre)
|
BIN
TestsUnitaires/LargestPourLesEtudiants.zip
Normal file
BIN
TestsUnitaires/LargestPourLesEtudiants.zip
Normal file
Binary file not shown.
1
TestsUnitaires/Memory.svg
Normal file
1
TestsUnitaires/Memory.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 27 KiB |
113
TestsUnitaires/MonInt.java
Normal file
113
TestsUnitaires/MonInt.java
Normal file
@@ -0,0 +1,113 @@
|
||||
// notez le s après Object. Permet entre autre de stipuler qu'un objet o n'est pas null avec la méthode Objects.requireNonNull(o, "message d'erreur détaillé");
|
||||
import java.util.Objects;
|
||||
|
||||
/*
|
||||
* Sorte de Int du pauvre à laquelle on ajoute un nom sous forme textuelle.
|
||||
*
|
||||
* Classe donnée à titre d'exemple pour illustrer les ingrédients techniques de la prog défensive.
|
||||
* et les assertions java
|
||||
*/
|
||||
public class MonInt {
|
||||
|
||||
// un entier
|
||||
private int valeur ;
|
||||
// son nom sous forme textuelle
|
||||
private String nom ;
|
||||
|
||||
public MonInt(int n, String s){
|
||||
this.valeur = n;
|
||||
this.nom = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* division du pauvre.
|
||||
*
|
||||
*
|
||||
* @param c le diviseur par lequel on souhaite diviser this
|
||||
*/
|
||||
public void divise (MonInt c){
|
||||
Objects.requireNonNull(c, "la classe denominateur ne peut pas être null");
|
||||
|
||||
int avant = this.valeur;
|
||||
|
||||
this.valeur = this.valeur / c.getValeur();
|
||||
this.nom = "(" + this.nom + " divisé par " + c.getNom() +")";
|
||||
|
||||
assert(this.valeur*c.getValeur() == avant); // NB. un assert qui ne marche pas tout le temps.
|
||||
}
|
||||
|
||||
/**
|
||||
* Un getter superstitieux.
|
||||
* retourne une exception si la valeur vaut 13.
|
||||
*/
|
||||
public int getValeur(){
|
||||
if (valeur == 13) throw new IllegalStateException("Comme disait Sacha Guitry, je ne suis pas superstitieux mais on ne sait jamais.");
|
||||
return valeur;
|
||||
}
|
||||
|
||||
public String getNom(){
|
||||
return nom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String representant l'entier.
|
||||
*/
|
||||
public String toString(){
|
||||
return this.getValeur() + " " + this.getNom();
|
||||
}
|
||||
|
||||
/**
|
||||
* C'est un peu moche mais on peut pour simplifier mettre des tests manuels dans un main dans chaque classe.
|
||||
* C'est plutôt mieux que de mettre des print dans chaque méthode car vous êtes plus sûr de la stabilité de vos tests
|
||||
* (vous pouvez rejouer les tests plus tard).
|
||||
*
|
||||
* Idéalement on utilise un outil dédié comme JUnit qui favorise au maximum cette automatisation.
|
||||
*
|
||||
* @param args pas de paramètre en ligne de commande prévu.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
MonInt c3 = new MonInt(3,"trois");
|
||||
MonInt c4 = new MonInt(4,"quatre");
|
||||
MonInt c9 = new MonInt(9,"neuf");
|
||||
MonInt c13 = new MonInt(13,"treize");
|
||||
System.out.println(c3.toString());
|
||||
System.out.println(c4.toString());
|
||||
System.out.println(c9.toString());
|
||||
|
||||
|
||||
c9.divise(c3);
|
||||
// 3
|
||||
System.out.println(c9.toString());
|
||||
|
||||
c3.divise(c4);
|
||||
// 0
|
||||
System.out.println(c3.toString());
|
||||
|
||||
// tester des exceptions pas pratique
|
||||
// Si on veut tester plusieurs exceptions
|
||||
// il faut attraper et vérifier que c'est le bon type d'exception.
|
||||
// ici manuellement en regardant le message.
|
||||
try {
|
||||
System.out.println(c13.toString()); // toucher au nbre 13 avec getValeur()
|
||||
}
|
||||
catch(Exception e){
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
try{
|
||||
c9.divise(c3); //division par 0
|
||||
}
|
||||
catch(Exception e){
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
try{
|
||||
c9.divise(null); //division par null
|
||||
}
|
||||
catch(Exception e){
|
||||
System.out.println(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
36
TestsUnitaires/README.md
Normal file
36
TestsUnitaires/README.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# BUT1-Test-Public
|
||||
|
||||
Contient les supports de cours, TD, TP et le code nécessaire pour faire les TPs pour DEV2.3, c'est-à-dire la partie du cours de DEV java qui est principalement une initiation aux tests unitaires.
|
||||
|
||||
|
||||
## Première semaine sur les tests ##
|
||||
|
||||
### CM ###
|
||||
petit historique bugs célèbres
|
||||
pastiche du lièvre et la tortue, le codeur qui ne fait jamais d'erreurs et le codeur qui fait toujours des tests.
|
||||
précondition
|
||||
postcondition
|
||||
invariant
|
||||
prog défensive
|
||||
|
||||
### TD ###
|
||||
Un peu de modélisation avec le jeu du Memory
|
||||
précondition, postcondition, invariant dans ce cadre
|
||||
|
||||
### TP ###
|
||||
Prise en main de JUnit sur le jeu du Memory
|
||||
|
||||
## Seconde semaine sur les tests ##
|
||||
|
||||
### CM ###
|
||||
Récapitulatif première semaine
|
||||
Notion de couverture : dans quelle mesure mes tests couvrent bien mon code?
|
||||
Right BICEP : Comment écrire des tests qui sont utiles?
|
||||
|
||||
### TD ###
|
||||
Principalement notion de couverture.
|
||||
|
||||
### TP ###
|
||||
Quelques détails sur JUnit4 pour servir de référence plus tard.
|
||||
Debug concret sur un exemple.
|
||||
|
BIN
TestsUnitaires/Shadockv0.zip
Normal file
BIN
TestsUnitaires/Shadockv0.zip
Normal file
Binary file not shown.
BIN
TestsUnitaires/git_tutorial.pdf
Normal file
BIN
TestsUnitaires/git_tutorial.pdf
Normal file
Binary file not shown.
BIN
TestsUnitaires/test.tar.gz
Normal file
BIN
TestsUnitaires/test.tar.gz
Normal file
Binary file not shown.
BIN
TestsUnitaires/v0Memory.zip
Normal file
BIN
TestsUnitaires/v0Memory.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user