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 #ifndef TEST_RESULT_H 19 #define TEST_RESULT_H 20 21 #ifndef TEST_PROBLEM_H 22 #include "test_problem.h" 23 #endif 24 25 26 //$Id 27 //a class to accumulate the results of tests. While you can add other 28 //test_results to it, it is not a composite; the added results 29 //are simply merged with the existing result 30 31 class test_result 32 { 33 protected: 34 //protected data members 35 //the accumulated errors 36 37 _VECTOR(test_problem, unit_test_allocator) m_errors; 38 //the accumulated failures 39 _VECTOR(test_problem, unit_test_allocator) m_failures; 40 41 //the number of successes 42 int m_success_count; 43 44 public: 45 //add errors and failures to the list 46 //add an error (problem in testing or error in test framework) 47 void add_error(const test_problem& new_error); 48 //add a failure (test for truth or equality failed) 49 void add_failure(const test_problem& new_error); 50 //add a success 51 void add_success(void); 52 //add another result 53 void add_result(const test_result& result); 54 //delete the contents of the result 55 void delete_contents(void); 56 57 //accessorts for the errors and failures in the test result 58 const _VECTOR(test_problem, unit_test_allocator)& errors(void) const; 59 const _VECTOR(test_problem, unit_test_allocator)& failures(void) const; 60 61 int success_count(void) const; 62 int total_test_count(void) const; 63 }; 64 65 66 #endif 67