• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 #include "test_result.h"
19 
20 //adds an error to the result
21 void
add_error(const test_problem & new_error)22 test_result::add_error(const test_problem& new_error)
23 {
24     m_errors.push_back(new_error);
25 }
26 
27 //adds a failure
28 void
add_failure(const test_problem & new_failure)29 test_result::add_failure(const test_problem& new_failure)
30 {
31     m_failures.push_back(new_failure);
32 }
33 
34 //adds a success
35 void
add_success(void)36 test_result::add_success(void)
37 {
38     ++m_success_count;
39 }
40 
41 //adds another result
42 void
add_result(const test_result & new_result)43 test_result::add_result(const test_result& new_result)
44 {
45     //add errors and failures
46     for (_VECTOR(test_problem, unit_test_allocator)::iterator iter = new_result.m_errors.begin(); iter != new_result.m_errors.end(); ++iter)
47     {
48         m_errors.push_back(*iter);
49     }
50 
51     for (_VECTOR(test_problem, unit_test_allocator)::iterator iter1 = new_result.m_failures.begin(); iter1 != new_result.m_failures.end(); ++iter1)
52     {
53         m_failures.push_back(*iter1);
54     }
55     //add successes
56     m_success_count += new_result.m_success_count;
57 }
58 
59 //deletes the contents of the test result
60 void
delete_contents(void)61 test_result::delete_contents(void)
62 {
63     m_errors.clear();
64     m_failures.clear();
65     m_success_count = 0;
66 }
67 
_VECTOR(test_problem,unit_test_allocator)68 const _VECTOR(test_problem, unit_test_allocator)&
69 test_result::errors(void) const
70 {
71     return m_errors;
72 }
73 
_VECTOR(test_problem,unit_test_allocator)74 const _VECTOR(test_problem, unit_test_allocator)&
75 test_result::failures(void) const
76 {
77     return m_failures;
78 }
79 
80 int
success_count(void) const81 test_result::success_count(void) const
82 {
83     return m_success_count;
84 }
85 
86 int
total_test_count(void) const87 test_result::total_test_count(void) const
88 {
89     return m_success_count
90            + m_errors.size()
91            + m_failures.size();
92 }
93 
94 
95