Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Pries, Jason
Oersted
Commits
3696af24
Commit
3696af24
authored
Oct 19, 2016
by
JasonPries
Browse files
Translate Sketch, Constraint unit tests
parent
b9df6731
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
.idea/Oersted.iml
View file @
3696af24
...
...
@@ -37,10 +37,12 @@
<sourceFolder
url=
"file://$MODULE_DIR$/test/main.cpp"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test/CMakeLists.txt"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test/Sketch/test_LineSegment.cpp"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test/Sketch/test_Sketch.cpp"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test/Sketch/test_Constraint.cpp"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test/Sketch/test_CircularArc.cpp"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test/Sketch/test_Sketch.h"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test/Sketch/test_Vertex.cpp"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test/Sketch/test_Star.cpp"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test/Sketch/test_Sketch.hpp"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/test/Sketch/test_Contour.cpp"
isTestSource=
"false"
/>
</content>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
...
...
test/CMakeLists.txt
View file @
3696af24
...
...
@@ -3,12 +3,15 @@ project(Oersted_Test)
set
(
SOURCE_FILES
main.cpp
Sketch/test_Sketch.h
Sketch/test_Sketch.hpp
Sketch/test_Vertex.cpp
Sketch/test_LineSegment.cpp
Sketch/test_CircularArc.cpp
Sketch/test_Star.cpp
Sketch/test_Contour.cpp
)
Sketch/test_Contour.cpp
Sketch/test_Sketch.cpp
Sketch/test_Constraint.cpp
)
add_executable
(
run_tests
${
SOURCE_FILES
}
)
...
...
test/Sketch/test_CircularArc.cpp
View file @
3696af24
#include
<math.h>
#include
<tgmath.h>
#include
"test_Sketch.h"
#include
"test_Sketch.h
pp
"
TEST
(
CIRCULARARC
,
CONSTRUCTOR
)
{
{
//ARGS::()
...
...
test/Sketch/test_Constraint.cpp
0 → 100644
View file @
3696af24
This diff is collapsed.
Click to expand it.
test/Sketch/test_Contour.cpp
View file @
3696af24
#include
"test_Sketch.h"
#include
"test_Sketch.h
pp
"
TEST
(
CONTOUR
,
CCW_TRIANGLE
)
{
Vertex
v0
{
1.0
,
0.0
};
...
...
test/Sketch/test_LineSegment.cpp
View file @
3696af24
#include
"test_Sketch.h"
#include
"test_Sketch.h
pp
"
TEST
(
LINESEGMENT
,
CONSTRUCTOR
)
{
{
// ARGS::()
...
...
test/Sketch/test_Sketch.cpp
0 → 100644
View file @
3696af24
#include
"test_Sketch.hpp"
TEST
(
SKETCH
,
CONSTRUCTOR
)
{
Sketch
s
;
}
TEST
(
SKETCH
,
METHOD_new_element_PARAM_Vertex
)
{
Sketch
s
;
Vertex
&
v0
=
s
.
new_element
<
Vertex
>
();
EXPECT_TRUE
(
s
.
size
()
==
1
);
EXPECT_TRUE
(
v0
.
get_equation_index
()
==
0
);
EXPECT_TRUE
(
v0
.
X
->
get_index
()
==
0
);
EXPECT_TRUE
(
v0
.
Y
->
get_index
()
==
1
);
Vertex
&
v1
=
s
.
new_element
<
Vertex
>
();
EXPECT_TRUE
(
s
.
size
()
==
2
);
EXPECT_TRUE
(
v1
.
get_equation_index
()
==
0
);
EXPECT_TRUE
(
v1
.
X
->
get_index
()
==
2
);
EXPECT_TRUE
(
v1
.
Y
->
get_index
()
==
3
);
}
TEST
(
SKETCH
,
METHOD_new_element_PARAM_LineSegment
)
{
Sketch
s
;
LineSegment
&
line
=
s
.
new_element
<
LineSegment
>
();
EXPECT_TRUE
(
s
.
size
()
==
1
);
}
TEST
(
SKETCH
,
METHOD_new_element_PARAM_CircularArc
)
{
Sketch
s
;
LineSegment
&
line
=
s
.
new_element
<
LineSegment
>
();
EXPECT_TRUE
(
s
.
size
()
==
1
);
}
TEST
(
SKETCH
,
METHOD_new_element_PARAM_Length
)
{
Sketch
s
;
Vertex
&
v0
=
s
.
new_element
<
Vertex
>
(
3.14159
,
2.7183
);
Vertex
&
v1
=
s
.
new_element
<
Vertex
>
(
6.14159
,
6.7183
);
LineSegment
&
line
=
s
.
new_element
<
LineSegment
>
(
v0
,
v1
);
Length
&
length
=
s
.
new_element
<
Length
>
(
line
,
1.0
);
EXPECT_TRUE
(
s
.
size
()
==
4
);
s
.
save_as
<
SaveMethod
::
Rasterize
>
(
SAVE_DIR
,
"SKETCH__METHOD_new_element_PARAM_Length.csv"
);
}
\ No newline at end of file
test/Sketch/test_Sketch.h
→
test/Sketch/test_Sketch.h
pp
View file @
3696af24
...
...
@@ -7,6 +7,7 @@
#include
<cmath>
#define TOL 4e-8 //#TODO: Tolerance is limited by accuracy of tangency constraint
#define SAVE_DIR "./test/output/"
using
namespace
std
;
...
...
test/Sketch/test_Star.cpp
View file @
3696af24
#include
"test_Sketch.h"
#include
"test_Sketch.h
pp
"
bool
star_angle_sum_equals_2pi
(
std
::
vector
<
Star
>
&
stars
)
{
for
(
auto
s
=
stars
.
begin
();
s
!=
stars
.
end
();
++
s
)
{
...
...
@@ -399,7 +399,7 @@ TEST(STAR, CONSTRUCTION_LINES) {
s
.
solve
();
s
.
build
();
s
.
save_as
<
SaveMethod
::
Rasterize
>
(
"./test/output/
Star/"
,
"construction_lines_0
.csv"
);
s
.
save_as
<
SaveMethod
::
Rasterize
>
(
"./test/output/
"
,
"STAR__CONSTRUCTION_LINES
.csv"
);
EXPECT_TRUE
(
s
.
size_contours
()
==
1
);
EXPECT_TRUE
(
s
.
contour
(
0
)
->
size
()
==
4
);
...
...
test/Sketch/test_Vertex.cpp
View file @
3696af24
#include
"test_Sketch.h"
#include
"test_Sketch.h
pp
"
TEST
(
VERTEX
,
CONSTRUCTOR
)
{
{
// ARGS::()
...
...
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