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
7e6fe1ab
Commit
7e6fe1ab
authored
Apr 18, 2021
by
Yann Boucher
Browse files
added Eugène's files to the .pro; fixed
#10
by implementing tests for Structure
parent
4b8a0359
Pipeline
#76529
passed with stages
in 17 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
include/neighbo
u
rhood.hpp
→
include/neighborhood.hpp
View file @
7e6fe1ab
...
...
@@ -15,9 +15,10 @@ Cette classe repr
#include
<vector>
#include
<utility>
#include
"coord.hpp"
using
namespace
std
;
class
Coord
;
class
State
;
/**
...
...
@@ -51,4 +52,4 @@ public:
}
};
#endif // NEIGHBOURHOOD_HPP
\ No newline at end of file
#endif // NEIGHBOURHOOD_HPP
include/property.hpp
View file @
7e6fe1ab
...
...
@@ -47,6 +47,7 @@ class PropertyVisitor
public:
virtual
~
PropertyVisitor
()
=
default
;
public:
virtual
void
visit
(
StringProperty
&
str
)
=
0
;
virtual
void
visit
(
IntegerProperty
&
str
)
=
0
;
virtual
void
visit
(
CoordinateProperty
&
coord
)
=
0
;
...
...
src/neighbo
u
rhood.cpp
→
src/neighborhood.cpp
View file @
7e6fe1ab
#include
"neighbo
u
rhood.hpp"
#include
"neighborhood.hpp"
unsigned
int
Neighborhood
::
getNb
(
State
state
)
{
...
...
src/src.pro
View file @
7e6fe1ab
...
...
@@ -13,14 +13,16 @@ INCLUDEPATH += ../include
SOURCES
+=
\
main
.
cpp
\
propertyvisitors
.
cpp
propertyvisitors
.
cpp
\
neighborhood
.
cpp
HEADERS
+=
\
..
/
include
/
coord
.
hpp
\
..
/
include
/
neighborhoodrule
.
hpp
\
..
/
include
/
property
.
hpp
\
..
/
include
/
propertyvisitors
.
hpp
\
..
/
include
/
structure
.
hpp
..
/
include
/
structure
.
hpp
\
..
/
include
/
neighborhood
.
hpp
#
Default
rules
for
deployment
.
...
...
tests/cellulut_tests.hpp
View file @
7e6fe1ab
...
...
@@ -9,6 +9,7 @@ class CellulutTests: public QObject
private
slots
:
void
test_property
();
void
test_loader_saver_visitor
();
void
test_structure
();
};
#endif // CELLULUT_TESTS_HPP
tests/structure_test.cpp
0 → 100644
View file @
7e6fe1ab
#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
;
}
}
}
tests/tests.pro
View file @
7e6fe1ab
...
...
@@ -17,7 +17,8 @@ SOURCES += \
..
/
src
/
propertyvisitors
.
cpp
\
property_test
.
cpp
\
propertyvisitors_test
.
cpp
\
cellulut_tests
.
cpp
cellulut_tests
.
cpp
\
structure_test
.
cpp
HEADERS
+=
\
cellulut_tests
.
hpp
...
...
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