Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
7c47cd34
Commit
7c47cd34
authored
Jan 14, 2015
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove 2 unit tests which make memory leaks
parent
29fa1558
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
documenttest.cpp
test/unittest/documenttest.cpp
+10
-0
unittest.cpp
test/unittest/unittest.cpp
+13
-3
No files found.
test/unittest/documenttest.cpp
View file @
7c47cd34
...
...
@@ -336,6 +336,10 @@ TYPED_TEST(DocumentMove, MoveConstructorParseError) {
EXPECT_EQ
(
c
.
GetErrorOffset
(),
error
.
Offset
());
}
// This test does not properly use parsing, just for testing.
// It must call ClearStack() explicitly to prevent memory leak.
// But here we cannot as ClearStack() is private.
#if 0
TYPED_TEST(DocumentMove, MoveConstructorStack) {
typedef TypeParam Allocator;
typedef UTF8<> Encoding;
...
...
@@ -360,6 +364,7 @@ TYPED_TEST(DocumentMove, MoveConstructorStack) {
EXPECT_EQ(b.GetStackCapacity(), defaultCapacity);
EXPECT_EQ(c.GetStackCapacity(), capacity);
}
#endif
TYPED_TEST
(
DocumentMove
,
MoveAssignment
)
{
typedef
TypeParam
Allocator
;
...
...
@@ -428,6 +433,10 @@ TYPED_TEST(DocumentMove, MoveAssignmentParseError) {
EXPECT_EQ
(
c
.
GetErrorOffset
(),
error
.
Offset
());
}
// This test does not properly use parsing, just for testing.
// It must call ClearStack() explicitly to prevent memory leak.
// But here we cannot as ClearStack() is private.
#if 0
TYPED_TEST(DocumentMove, MoveAssignmentStack) {
typedef TypeParam Allocator;
typedef UTF8<> Encoding;
...
...
@@ -454,6 +463,7 @@ TYPED_TEST(DocumentMove, MoveAssignmentStack) {
EXPECT_EQ(b.GetStackCapacity(), defaultCapacity);
EXPECT_EQ(c.GetStackCapacity(), capacity);
}
#endif
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
...
...
test/unittest/unittest.cpp
View file @
7c47cd34
...
...
@@ -21,10 +21,20 @@
#include "unittest.h"
int
main
(
int
argc
,
char
**
argv
)
{
::
testing
::
InitGoogleTest
(
&
argc
,
argv
);
#if _MSC_VER
_CrtSetDbgFlag
(
_CRTDBG_ALLOC_MEM_DF
|
_CRTDBG_LEAK_CHECK_DF
);
_CrtMemState
memoryState
=
{
0
};
_CrtMemCheckpoint
(
&
memoryState
);
//_CrtSetBreakAlloc(X);
//void *testWhetherMemoryLeakDetectionWorks = malloc(1);
#endif
::
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
int
ret
=
RUN_ALL_TESTS
();
#if _MSC_VER
// Current gtest constantly leak 2 blocks at exit
_CrtMemDumpAllObjectsSince
(
&
memoryState
);
#endif
return
ret
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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