Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
9a3afe96
Commit
9a3afe96
authored
5 years ago
by
Nat Goodspeed
Browse files
Options
Downloads
Patches
Plain Diff
DRTVWR-476: Add basic tests for LLCond.
parent
3810145c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llcommon/CMakeLists.txt
+2
-0
2 additions, 0 deletions
indra/llcommon/CMakeLists.txt
indra/llcommon/tests/llcond_test.cpp
+67
-0
67 additions, 0 deletions
indra/llcommon/tests/llcond_test.cpp
with
69 additions
and
0 deletions
indra/llcommon/CMakeLists.txt
+
2
−
0
View file @
9a3afe96
...
...
@@ -145,6 +145,7 @@ set(llcommon_HEADER_FILES
llcleanup.h
llcommon.h
llcommonutils.h
llcond.h
llcoros.h
llcrc.h
llcriticaldamp.h
...
...
@@ -327,6 +328,7 @@ if (LL_TESTS)
LL_ADD_INTEGRATION_TEST
(
commonmisc
""
"
${
test_libs
}
"
)
LL_ADD_INTEGRATION_TEST
(
bitpack
""
"
${
test_libs
}
"
)
LL_ADD_INTEGRATION_TEST
(
llbase64
""
"
${
test_libs
}
"
)
LL_ADD_INTEGRATION_TEST
(
llcond
""
"
${
test_libs
}
"
)
LL_ADD_INTEGRATION_TEST
(
lldate
""
"
${
test_libs
}
"
)
LL_ADD_INTEGRATION_TEST
(
lldeadmantimer
""
"
${
test_libs
}
"
)
LL_ADD_INTEGRATION_TEST
(
lldependencies
""
"
${
test_libs
}
"
)
...
...
This diff is collapsed.
Click to expand it.
indra/llcommon/tests/llcond_test.cpp
0 → 100644
+
67
−
0
View file @
9a3afe96
/**
* @file llcond_test.cpp
* @author Nat Goodspeed
* @date 2019-07-18
* @brief Test for llcond.
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Copyright (c) 2019, Linden Research, Inc.
* $/LicenseInfo$
*/
// Precompiled header
#include
"linden_common.h"
// associated header
#include
"llcond.h"
// STL headers
// std headers
// external library headers
// other Linden headers
#include
"../test/lltut.h"
#include
"llcoros.h"
/*****************************************************************************
* TUT
*****************************************************************************/
namespace
tut
{
struct
llcond_data
{
LLScalarCond
<
int
>
cond
{
0
};
};
typedef
test_group
<
llcond_data
>
llcond_group
;
typedef
llcond_group
::
object
object
;
llcond_group
llcondgrp
(
"llcond"
);
template
<
>
template
<
>
void
object
::
test
<
1
>
()
{
set_test_name
(
"Immediate gratification"
);
cond
.
set_one
(
1
);
ensure
(
"wait_for_equal() failed"
,
cond
.
wait_for_equal
(
F32Milliseconds
(
1
),
1
));
ensure
(
"wait_for_unequal() should have failed"
,
!
cond
.
wait_for_unequal
(
F32Milliseconds
(
1
),
1
));
}
template
<
>
template
<
>
void
object
::
test
<
2
>
()
{
set_test_name
(
"Simple two-coroutine test"
);
LLCoros
::
instance
().
launch
(
"test<2>"
,
[
this
]()
{
// Lambda immediately entered -- control comes here first.
ensure_equals
(
cond
.
get
(),
0
);
cond
.
set_all
(
1
);
cond
.
wait_equal
(
2
);
ensure_equals
(
cond
.
get
(),
2
);
cond
.
set_all
(
3
);
});
// Main coroutine is resumed only when the lambda waits.
ensure_equals
(
cond
.
get
(),
1
);
cond
.
set_all
(
2
);
cond
.
wait_equal
(
3
);
}
}
// namespace tut
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