Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
4809fc2d
Commit
4809fc2d
authored
6 years ago
by
Angel Santamaria-Navarro
Browse files
Options
Downloads
Patches
Plain Diff
FIX gtests with new API
parent
0dc055ca
No related branches found
No related tags found
1 merge request
!211
State blocks
Pipeline
#2159
failed
6 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/gtest_ceres_manager.cpp
+0
-6
0 additions, 6 deletions
src/test/gtest_ceres_manager.cpp
src/test/gtest_solver_manager.cpp
+70
-20
70 additions, 20 deletions
src/test/gtest_solver_manager.cpp
with
70 additions
and
26 deletions
src/test/gtest_ceres_manager.cpp
+
0
−
6
View file @
4809fc2d
...
...
@@ -238,12 +238,6 @@ TEST(CeresManager, RemoveUpdateStateBlock)
// update solver
ceres_manager_ptr
->
update
();
// Fix state block
sb_ptr
->
fix
();
// update solver manager
ceres_manager_ptr
->
update
();
}
TEST
(
CeresManager
,
DoubleRemoveStateBlock
)
...
...
This diff is collapsed.
Click to expand it.
src/test/gtest_solver_manager.cpp
+
70
−
20
View file @
4809fc2d
...
...
@@ -80,7 +80,7 @@ TEST(SolverManager, Create)
ProblemPtr
P
=
Problem
::
create
(
"PO 2D"
);
SolverManagerWrapperPtr
solver_manager_ptr
=
std
::
make_shared
<
SolverManagerWrapper
>
(
P
);
// check double ointers to branches
// check double
p
ointers to branches
ASSERT_EQ
(
P
,
solver_manager_ptr
->
getProblemPtr
());
}
...
...
@@ -235,7 +235,7 @@ TEST(SolverManager, RemoveUpdateStateBlock)
Vector2s
state
;
state
<<
1
,
2
;
StateBlockPtr
sb_ptr
=
std
::
make_shared
<
StateBlock
>
(
state
);
// add stateblock
// add state
_
block
P
->
addStateBlock
(
sb_ptr
);
// remove state_block
...
...
@@ -243,12 +243,6 @@ TEST(SolverManager, RemoveUpdateStateBlock)
// update solver
solver_manager_ptr
->
update
();
// Fix state block
sb_ptr
->
fix
();
// update solver manager
solver_manager_ptr
->
update
();
}
TEST
(
SolverManager
,
DoubleRemoveStateBlock
)
...
...
@@ -292,22 +286,78 @@ TEST(SolverManager, AddUpdatedStateBlock)
Vector2s
state_2
=
2
*
state
;
sb_ptr
->
setState
(
state_2
);
// add stateblock
// == First add 2 UPDATES (FIX and STATE) ==
// The expected order is:
// ADD in front of the list
// Others in historical order
ASSERT_EQ
(
sb_ptr
->
getNotifications
().
size
(),
2
);
// UPDATE_FIX, UPDATE_STATE
StateBlock
::
Notifications
sb_notif
=
sb_ptr
->
getNotifications
();
StateBlock
::
Notifications
::
iterator
iter
=
sb_notif
.
begin
();
ASSERT_EQ
(
*
iter
,
StateBlock
::
Notification
::
UPDATE_FIX
);
iter
++
;
ASSERT_EQ
(
*
iter
,
StateBlock
::
Notification
::
UPDATE_STATE
);
// == When an ADD is notified, all previous notifications should be cleared (if not consumption of notifs) ==
// add state_block
P
->
addStateBlock
(
sb_ptr
);
// Get list of SB notifications
StateBlockList
P_notif_sb
=
P
->
getNotifiedStateBlockList
();
for
(
auto
sb
:
P_notif_sb
)
{
// Notifications come in historial order
StateBlock
::
Notifications
sb_notif
=
sb
->
getNotifications
();
StateBlock
::
Notifications
::
iterator
iter
=
sb_notif
.
begin
();
EXPECT_EQ
(
*
iter
,
StateBlock
::
Notification
::
UPDATE_FIX
);
iter
++
;
EXPECT_EQ
(
*
iter
,
StateBlock
::
Notification
::
UPDATE_STATE
);
iter
++
;
EXPECT_EQ
(
*
iter
,
StateBlock
::
Notification
::
ADD
);
}
ASSERT_EQ
(
P_notif_sb
.
size
(),
1
);
sb_notif
=
P_notif_sb
.
front
()
->
getNotifications
();
ASSERT_EQ
(
sb_notif
.
size
(),
1
);
ASSERT_EQ
(
sb_notif
.
front
(),
StateBlock
::
Notification
::
ADD
);
// == Insert OTHER notifications ==
// Set State
state_2
=
2
*
state
;
sb_ptr
->
setState
(
state_2
);
// Fix
sb_ptr
->
unfix
();
sb_notif
=
P_notif_sb
.
front
()
->
getNotifications
();
ASSERT_EQ
(
sb_notif
.
size
(),
3
);
// ADD, UPDATE_STATE, UPDATE_FIX
iter
=
sb_notif
.
begin
();
ASSERT_EQ
(
*
iter
,
StateBlock
::
Notification
::
ADD
);
iter
++
;
ASSERT_EQ
(
*
iter
,
StateBlock
::
Notification
::
UPDATE_STATE
);
iter
++
;
ASSERT_EQ
(
*
iter
,
StateBlock
::
Notification
::
UPDATE_FIX
);
// == REMOVE should clear all previous notifications in the stack because there's an ADD ==
// remove state_block
P
->
removeStateBlockPtr
(
sb_ptr
);
P_notif_sb
=
P
->
getNotifiedStateBlockList
();
ASSERT_EQ
(
P_notif_sb
.
size
(),
1
);
sb_notif
=
P_notif_sb
.
front
()
->
getNotifications
();
ASSERT_EQ
(
sb_notif
.
size
(),
0
);
// ADD + REMOVE = EMPTY
// == UPDATES + REMOVE should clear the list of notifications ==
// Fix
sb_ptr
->
fix
();
// Set State
state_2
=
2
*
state
;
sb_ptr
->
setState
(
state_2
);
// remove state_block
P
->
removeStateBlockPtr
(
sb_ptr
);
sb_notif
=
P_notif_sb
.
front
()
->
getNotifications
();
ASSERT_EQ
(
sb_notif
.
size
(),
1
);
ASSERT_EQ
(
sb_notif
.
front
(),
StateBlock
::
Notification
::
REMOVE
);
}
TEST
(
SolverManager
,
AddConstraint
)
...
...
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