Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
unionized-triangles-2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Brandon Lai-Cheong
unionized-triangles-2
Commits
1fa96490
Commit
1fa96490
authored
5 months ago
by
Brandon Lai-Cheong
Browse files
Options
Downloads
Patches
Plain Diff
added tests
parent
3d0ec474
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Alt triangulation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/edge_union_cases.cpp
+16
-0
16 additions, 0 deletions
tests/edge_union_cases.cpp
tests/unit_tests/convex_triangulation_tests.cpp
+41
-0
41 additions, 0 deletions
tests/unit_tests/convex_triangulation_tests.cpp
with
57 additions
and
0 deletions
tests/edge_union_cases.cpp
0 → 100644
+
16
−
0
View file @
1fa96490
#include
<gtest/gtest.h>
#include
<union.h>
#include
<triangle.h>
TEST
(
UnionEdgeTests
,
TriangleVertexOnEdge
)
{
Triangle
t1
=
Triangle
({},
{},
{},
1
,
1
);
Triangle
t2
=
Triangle
({},
{},
{},
2
,
2
);
auto
result
=
unionize
(
t1
,
t2
);
}
TEST
(
UnionEdgeTests
,
TriangleEdgeLength0
)
{
Triangle
t1
=
Triangle
({
1
,
1
},
{
2
,
2
},
{
3
,
3
},
1
,
1
);
Triangle
t2
=
Triangle
({},
{},
{},
2
,
2
);
}
This diff is collapsed.
Click to expand it.
tests/unit_tests/convex_triangulation_tests.cpp
0 → 100644
+
41
−
0
View file @
1fa96490
#include
<gtest/gtest.h>
#include
<convex_triangulation.h>
#include
<vector>
TEST
(
ConvexTriangulationTests
,
Simple
)
{
Point
p1
{
1
,
3
};
Point
p2
{
2
,
2
};
Point
p3
{
3
,
2.1
};
Point
p4
{
4
,
3.2
};
Point
p5
{
2.1
,
4
};
std
::
vector
<
Point
>
points
=
{
p1
,
p2
,
p3
,
p4
,
p5
};
auto
results
=
convexTriangulation
(
points
,
2
,
2
);
std
::
vector
<
Triangle
>
expected_result
{
Triangle
(
p1
,
p2
,
p3
,
2
,
2
),
Triangle
(
p1
,
p3
,
p5
,
2
,
2
),
Triangle
(
p5
,
p3
,
p4
,
2
,
2
)
};
EXPECT_EQ
(
results
,
expected_result
);
}
TEST
(
ConvexTriangulationTests
,
TrivialTriangle
)
{
std
::
vector
<
Point
>
points
=
{
{
0
,
0
},
{
2
,
0
},
{
1.5
,
2
}
};
auto
results
=
convexTriangulation
(
points
,
1
,
1
);
Triangle
expected_triangle
=
Triangle
({
0
,
0
},
{
2
,
0
},
{
1.5
,
2
},
1
,
1
);
EXPECT_EQ
(
results
.
size
(),
1
);
EXPECT_EQ
(
results
[
0
],
expected_triangle
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment