Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
77454c4c
Commit
77454c4c
authored
10 years ago
by
Jan Trávníček
Browse files
Options
Downloads
Patches
Plain Diff
overal statistics of tests
parent
795543f5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
alib2/test-src/main.cpp
+16
-4
16 additions, 4 deletions
alib2/test-src/main.cpp
with
16 additions
and
4 deletions
alib2/test-src/main.cpp
+
16
−
4
View file @
77454c4c
...
@@ -28,17 +28,22 @@ public:
...
@@ -28,17 +28,22 @@ public:
void
endTest
(
Test
*
test
);
void
endTest
(
Test
*
test
);
int
getResult
()
const
;
int
getResult
()
const
;
void
printResults
()
const
;
private:
private:
TestProgressListener
(
const
TestProgressListener
&
copy
);
TestProgressListener
(
const
TestProgressListener
&
copy
);
void
operator
=
(
const
TestProgressListener
&
copy
);
void
operator
=
(
const
TestProgressListener
&
copy
);
private:
private:
int
m_Result
;
int
m_Failures
;
int
m_Tests
;
int
m_Assertions
;
bool
m_lastTestFailed
;
bool
m_lastTestFailed
;
};
};
TestProgressListener
::
TestProgressListener
()
:
m_
Result
(
0
),
m_lastTestFailed
(
false
)
TestProgressListener
::
TestProgressListener
()
:
m_
Failures
(
0
),
m_Tests
(
0
),
m_Assertions
(
0
),
m_lastTestFailed
(
false
)
{
{
}
}
...
@@ -52,6 +57,7 @@ void TestProgressListener::startTest( Test * test )
...
@@ -52,6 +57,7 @@ void TestProgressListener::startTest( Test * test )
stdCOut
().
flush
();
stdCOut
().
flush
();
m_lastTestFailed
=
false
;
m_lastTestFailed
=
false
;
m_Tests
++
;
}
}
void
TestProgressListener
::
addFailure
(
const
TestFailure
&
failure
)
void
TestProgressListener
::
addFailure
(
const
TestFailure
&
failure
)
...
@@ -60,7 +66,7 @@ void TestProgressListener::addFailure( const TestFailure &failure )
...
@@ -60,7 +66,7 @@ void TestProgressListener::addFailure( const TestFailure &failure )
stdCOut
()
<<
"Exception "
<<
failure
.
thrownException
()
->
message
().
details
();
stdCOut
()
<<
"Exception "
<<
failure
.
thrownException
()
->
message
().
details
();
m_lastTestFailed
=
true
;
m_lastTestFailed
=
true
;
m_Result
++
;
if
(
failure
.
isError
())
m_Failures
++
;
else
m_Assertions
++
;
}
}
void
TestProgressListener
::
endTest
(
Test
*
test
)
void
TestProgressListener
::
endTest
(
Test
*
test
)
...
@@ -76,7 +82,11 @@ void TestProgressListener::endTest( Test * test)
...
@@ -76,7 +82,11 @@ void TestProgressListener::endTest( Test * test)
}
}
int
TestProgressListener
::
getResult
()
const
{
int
TestProgressListener
::
getResult
()
const
{
return
m_Result
;
return
m_Failures
+
m_Assertions
;
}
void
TestProgressListener
::
printResults
()
const
{
stdCOut
()
<<
"Overal result: Tests: "
<<
m_Tests
<<
" Assertions: "
<<
m_Assertions
<<
" Failures: "
<<
m_Failures
<<
"
\n
"
;
}
}
CPPUNIT_NS_END
CPPUNIT_NS_END
...
@@ -104,5 +114,7 @@ int main(int , char*[])
...
@@ -104,5 +114,7 @@ int main(int , char*[])
// Run the tests.
// Run the tests.
runner
.
run
(
controller
);
runner
.
run
(
controller
);
progressListener
.
printResults
();
return
progressListener
.
getResult
();
return
progressListener
.
getResult
();
}
}
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