/documentation/html/_o_j_test_result_8j_source.html
http://github.com/hammerdr/OJTest · HTML · 160 lines · 159 code · 0 blank · 1 comment · 0 complexity · c7540ec2c372766f7d2c1cee87c02fd7 MD5 · raw file
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
- <title>Objective-J Test API: Frameworks/OJUnit/OJTestResult.j Source File</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <link href="doxygen.css" rel="stylesheet" type="text/css"/>
- </head>
- <body>
- <!-- Generated by Doxygen 1.6.1 -->
- <div class="navigation" id="top">
- <div class="tabs">
- <ul>
- <li><a href="main.html"><span>Main Page</span></a></li>
- <li><a href="annotated.html"><span>Classes</span></a></li>
- <li class="current"><a href="files.html"><span>Files</span></a></li>
- </ul>
- </div>
- <div class="tabs">
- <ul>
- <li><a href="files.html"><span>File List</span></a></li>
- <li><a href="globals.html"><span>File Members</span></a></li>
- </ul>
- </div>
- <h1>Frameworks/OJUnit/OJTestResult.j</h1><a href="_o_j_test_result_8j.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 @<span class="keyword">import</span> <Foundation/Foundation.j>
- <a name="l00002"></a>00002
- <a name="l00003"></a>00003 @<span class="keyword">import</span> <span class="stringliteral">"OJTestFailure.j"</span>
- <a name="l00004"></a>00004
- <a name="l00005"></a><a class="code" href="class_o_j_test_result.html">00005</a> <span class="keyword">@implementation </span><a class="code" href="class_o_j_test_result.html">OJTestResult</a> : CPObject
- <a name="l00006"></a>00006 {
- <a name="l00007"></a>00007 <a class="code" href="class_c_p_array.html">CPArray</a> _failures;
- <a name="l00008"></a>00008 <a class="code" href="class_c_p_array.html">CPArray</a> _errors;
- <a name="l00009"></a>00009 <a class="code" href="class_c_p_array.html">CPArray</a> _listeners;
- <a name="l00010"></a>00010 <span class="keywordtype">int</span> _runTests;
- <a name="l00011"></a>00011 BOOL _stop;
- <a name="l00012"></a>00012 }
- <a name="l00013"></a>00013
- <a name="l00014"></a><a class="code" href="class_o_j_test_result.html#a958008622c78ca95ac1daa312aa68468">00014</a> - (id)init
- <a name="l00015"></a>00015 {
- <a name="l00016"></a>00016 <span class="keywordflow">if</span> (<span class="keyword">self</span> = [super init])
- <a name="l00017"></a>00017 {
- <a name="l00018"></a>00018 _failures = [];
- <a name="l00019"></a>00019 _errors = [];
- <a name="l00020"></a>00020 _listeners = [];
- <a name="l00021"></a>00021 _runTests = 0;
- <a name="l00022"></a>00022 _stop = NO;
- <a name="l00023"></a>00023 }
- <a name="l00024"></a>00024 <span class="keywordflow">return</span> <span class="keyword">self</span>;
- <a name="l00025"></a>00025 }
- <a name="l00026"></a>00026
- <a name="l00027"></a><a class="code" href="class_o_j_test_result.html#a81ee04efc244158e867430ce7c57d568">00027</a> - (void)addError:(CPException)error forTest:(OJTest)aTest
- <a name="l00028"></a>00028 {
- <a name="l00029"></a>00029 [_failures addObject:[[<a class="code" href="class_o_j_test_failure.html">OJTestFailure</a> alloc] initWithTest:aTest exception:error]];
- <a name="l00030"></a>00030 <span class="keywordflow">for</span> (var i = 0; i < _listeners.length; i++)
- <a name="l00031"></a>00031 [_listeners[i] addError:error forTest:aTest];
- <a name="l00032"></a>00032 }
- <a name="l00033"></a>00033
- <a name="l00034"></a><a class="code" href="class_o_j_test_result.html#a2064f2b24f5bdf5352ad5af3c4128acb">00034</a> - (void)addFailure:(CPException)failure forTest:(OJTest)aTest
- <a name="l00035"></a>00035 {
- <a name="l00036"></a>00036 [_errors addObject:[[<a class="code" href="class_o_j_test_failure.html">OJTestFailure</a> alloc] initWithTest:aTest exception:failure]];
- <a name="l00037"></a>00037 <span class="keywordflow">for</span> (var i = 0; i < _listeners.length; i++)
- <a name="l00038"></a>00038 [_listeners[i] addFailure:failure forTest:aTest];
- <a name="l00039"></a>00039 }
- <a name="l00040"></a>00040
- <a name="l00041"></a><a class="code" href="class_o_j_test_result.html#ad528fd618ba825e009057a9cf08ab0b9">00041</a> - (void)startTest:(OJTest)aTest
- <a name="l00042"></a>00042 {
- <a name="l00043"></a>00043 _runTests += [aTest countTestCases];
- <a name="l00044"></a>00044 <span class="keywordflow">for</span> (var i = 0; i < _listeners.length; i++)
- <a name="l00045"></a>00045 [_listeners[i] startTest:aTest];
- <a name="l00046"></a>00046 }
- <a name="l00047"></a>00047
- <a name="l00048"></a><a class="code" href="class_o_j_test_result.html#a906bf681ca5917140341ad3966b6fe84">00048</a> - (void)endTest:(OJTest)aTest
- <a name="l00049"></a>00049 {
- <a name="l00050"></a>00050
- <a name="l00051"></a>00051 <span class="keywordflow">for</span> (var i = 0; i < _listeners.length; i++)
- <a name="l00052"></a>00052 [_listeners[i] endTest:aTest];
- <a name="l00053"></a>00053 }
- <a name="l00054"></a>00054
- <a name="l00055"></a><a class="code" href="class_o_j_test_result.html#ac6751606953c05705d51a92172b8785a">00055</a> - (void)run:(<a class="code" href="class_o_j_test_case.html" title="A single test case.">OJTestCase</a>)aTest
- <a name="l00056"></a>00056 {
- <a name="l00057"></a>00057 [<span class="keyword">self</span> <a class="code" href="class_o_j_test_result.html#ad528fd618ba825e009057a9cf08ab0b9">startTest</a>:aTest];
- <a name="l00058"></a>00058
- <a name="l00059"></a>00059 <span class="keywordflow">try</span>
- <a name="l00060"></a>00060 {
- <a name="l00061"></a>00061 [aTest <a class="code" href="class_o_j_test_case.html#a7b8ba2493662e7a39f9bcbf4f388c3a6">runBare</a>];
- <a name="l00062"></a>00062 }
- <a name="l00063"></a>00063 <span class="keywordflow">catch</span> (e)
- <a name="l00064"></a>00064 {
- <a name="l00065"></a>00065 <span class="comment">// if not objj object, toll-free bridge to CPException</span>
- <a name="l00066"></a>00066 <span class="keywordflow">if</span> (!e.isa) {
- <a name="l00067"></a>00067 CPLog.warn(<span class="stringliteral">"toll-free bridging e="</span>+e+<span class="stringliteral">" to CPException"</span>)
- <a name="l00068"></a>00068 e.isa = CPException;
- <a name="l00069"></a>00069 }
- <a name="l00070"></a>00070
- <a name="l00071"></a>00071 <span class="keywordflow">if</span> ([e name] == <a class="code" href="_o_j_test_case_8j.html#aa10f982f898aa31345dc071930167429">AssertionFailedError</a>)
- <a name="l00072"></a>00072 [<span class="keyword">self</span> <a class="code" href="class_o_j_test_result.html#a2064f2b24f5bdf5352ad5af3c4128acb">addFailure</a>:e <a class="code" href="class_o_j_test_result.html#a2064f2b24f5bdf5352ad5af3c4128acb">forTest</a>:aTest];
- <a name="l00073"></a>00073 <span class="keywordflow">else</span>
- <a name="l00074"></a>00074 [<span class="keyword">self</span> <a class="code" href="class_o_j_test_result.html#a81ee04efc244158e867430ce7c57d568">addError</a>:e <a class="code" href="class_o_j_test_result.html#a81ee04efc244158e867430ce7c57d568">forTest</a>:aTest];
- <a name="l00075"></a>00075 }
- <a name="l00076"></a>00076
- <a name="l00077"></a>00077 [<span class="keyword">self</span> <a class="code" href="class_o_j_test_result.html#a906bf681ca5917140341ad3966b6fe84">endTest</a>:aTest];
- <a name="l00078"></a>00078 }
- <a name="l00079"></a>00079
- <a name="l00080"></a><a class="code" href="class_o_j_test_result.html#afefb20de31199493e7d6a776525b68ba">00080</a> - (void)addListener:(OJTestListener)listener
- <a name="l00081"></a>00081 {
- <a name="l00082"></a>00082 [_listeners addObject:listener];
- <a name="l00083"></a>00083 }
- <a name="l00084"></a>00084
- <a name="l00085"></a><a class="code" href="class_o_j_test_result.html#ae8805ca853bf14f83bc253322d4b9b58">00085</a> - (void)removeListener:(OJTestListener)listener
- <a name="l00086"></a>00086 {
- <a name="l00087"></a>00087 [_listeners removeObject:listener];
- <a name="l00088"></a>00088 }
- <a name="l00089"></a>00089
- <a name="l00090"></a><a class="code" href="class_o_j_test_result.html#a618aefa522324d770cd30446650d2b39">00090</a> - (int)runCount
- <a name="l00091"></a>00091 {
- <a name="l00092"></a>00092 <span class="keywordflow">return</span> _runTests;
- <a name="l00093"></a>00093 }
- <a name="l00094"></a>00094
- <a name="l00095"></a><a class="code" href="class_o_j_test_result.html#ae969b06b725ae1dad3a61487f0afd6ea">00095</a> - (BOOL)shouldStop
- <a name="l00096"></a>00096 {
- <a name="l00097"></a>00097 <span class="keywordflow">return</span> _stop;
- <a name="l00098"></a>00098 }
- <a name="l00099"></a>00099
- <a name="l00100"></a><a class="code" href="class_o_j_test_result.html#a596cb460a67d01b0246dbfa2cb55465d">00100</a> - (void)stop
- <a name="l00101"></a>00101 {
- <a name="l00102"></a>00102 _stop = YES;
- <a name="l00103"></a>00103 }
- <a name="l00104"></a>00104
- <a name="l00105"></a><a class="code" href="class_o_j_test_result.html#ab7725dc356d3013abbd64c09b1b4ae1a">00105</a> - (int)failureCount
- <a name="l00106"></a>00106 {
- <a name="l00107"></a>00107 <span class="keywordflow">return</span> [_failures count];
- <a name="l00108"></a>00108 }
- <a name="l00109"></a>00109
- <a name="l00110"></a><a class="code" href="class_o_j_test_result.html#afd4c5ac643f6c2c745dbb8fb26f1d4ea">00110</a> - (<a class="code" href="class_c_p_array.html">CPArray</a>)failures
- <a name="l00111"></a>00111 {
- <a name="l00112"></a>00112 <span class="keywordflow">return</span> _failures;
- <a name="l00113"></a>00113 }
- <a name="l00114"></a>00114
- <a name="l00115"></a><a class="code" href="class_o_j_test_result.html#a825348fdab6a8f2bb27a2309af371781">00115</a> - (int)errorCount
- <a name="l00116"></a>00116 {
- <a name="l00117"></a>00117 <span class="keywordflow">return</span> [_errors count];
- <a name="l00118"></a>00118 }
- <a name="l00119"></a>00119
- <a name="l00120"></a><a class="code" href="class_o_j_test_result.html#abc8c820f190b9ec947f7f35b62c1d343">00120</a> - (<a class="code" href="class_c_p_array.html">CPArray</a>)errors
- <a name="l00121"></a>00121 {
- <a name="l00122"></a>00122 <span class="keywordflow">return</span> _errors;
- <a name="l00123"></a>00123 }
- <a name="l00124"></a>00124
- <a name="l00125"></a><a class="code" href="class_o_j_test_result.html#a23e0b484fab4c6989bea71f8f79564c0">00125</a> - (BOOL)wasSuccessful
- <a name="l00126"></a>00126 {
- <a name="l00127"></a>00127 <span class="keywordflow">return</span> [<span class="keyword">self</span> <a class="code" href="class_o_j_test_result.html#ab7725dc356d3013abbd64c09b1b4ae1a">failureCount</a>] == 0 && [<span class="keyword">self</span> <a class="code" href="class_o_j_test_result.html#a825348fdab6a8f2bb27a2309af371781">errorCount</a>] == 0;
- <a name="l00128"></a>00128 }
- <a name="l00129"></a>00129
- <a name="l00130"></a>00130 <span class="keyword">@end</span>
- </pre></div></div>
- <hr size="1"/><address style="text-align: right;"><small>Generated on Sat Feb 20 02:20:16 2010 for Objective-J Test API by
- <a href="http://www.doxygen.org/index.html">
- <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
- </body>
- </html>