Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LO21_Pin_Noir_Boucher_Bouri_Detree
CellulutLO21
Commits
3e441c8d
Commit
3e441c8d
authored
Apr 20, 2021
by
Yann Boucher
Browse files
Add CONTRIBUTING, fixing
#23
parent
6b8c3596
Pipeline
#76701
passed with stages
in 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CONTRIBUTING.md
0 → 100644
View file @
3e441c8d
# Contributions
## Code applicatif
### Fichiers source
Ajouter les fichiers .cpp dans src/, et rajouter une ligne (si elle n'est pas automatiquement ajoutée par QtCreator)
```
SOURCES += \
<sources précédentes> \
<votre_nouveau_fichier>.cpp
```
### Fichiers header
Ajouter les fichiers .hpp dans include/, et rajouter une ligne (si elle n'est pas automatiquement ajoutée par QtCreator)
```
HEADERS += \
<headers précédents> \
<votre_nouvel_header>.hpp
```
## Tests
Documentation du module de tests de Qt :
[
https://doc.qt.io/qt-5/qtest-overview.html
](
https://doc.qt.io/qt-5/qtest-overview.html
)
### Pour rajouter un test :
Dans cellulut_tests.hpp, rajouter une méthode
`test_votretest()`
parmis les
`private slots`
de la classe
`CellulutTests`
.
Dans un fichier votretest.cpp (à rajouter dans la liste de SOURCES de tests.pro), rajouter l'implémentation de cette méthode.
Exemple :
```
cpp
#include
<QtTest/QtTest>
#include
<algorithm>
#include
"cellulut_tests.hpp"
#include
"structure.hpp"
void
CellulutTests
::
test_structure
()
{
std
::
vector
<
std
::
pair
<
Coord
,
int
>>
coords
;
std
::
vector
<
std
::
pair
<
Coord
,
int
>>
empty
;
coords
.
push_back
({{
1
,
2
},
0
});
coords
.
push_back
({{
-
1
,
2
},
1
});
{
Structure
s1
(
coords
.
begin
(),
coords
.
end
());
Structure
s2
;
s2
.
load
(
coords
.
begin
(),
coords
.
end
());
QCOMPARE
(
s1
.
size
(),
coords
.
size
());
QCOMPARE
(
s2
.
size
(),
coords
.
size
());
QVERIFY
(
std
::
equal
(
coords
.
begin
(),
coords
.
end
(),
s1
.
begin
()));
QVERIFY
(
std
::
equal
(
coords
.
begin
(),
coords
.
end
(),
s2
.
begin
()));
s1
.
load
(
empty
.
begin
(),
empty
.
end
());
QVERIFY
(
s1
.
size
()
==
0
);
int
cnt
=
0
;
for
(
auto
val
:
s2
)
{
QVERIFY
(
val
==
coords
[
cnt
]);
++
cnt
;
}
}
}
```
### Macros utiles
Pour vérifier qu'une valeur est égale à la valeur attendue :
`QCOMPATE(val_testee, val_attendue)`
Pour vérifier qu'une expression booléenne est
`true`
:
`QVERIFIY(<votre_expression>)`
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment