30 | | UI::get (support, set, "support", UI::optional ); |
31 | | UI::get (nbins, set, "nbins", UI::optional ); |
32 | | UI::get (nsamples, set, "nsamples", UI::optional ); |
33 | | UI::get (R, set, "R", UI::optional ); |
34 | | |
35 | | mrv = UI::build<RV> (set, "marginal_rv", UI::optional ); |
| 30 | UI::get ( support, set, "support", UI::optional ); |
| 31 | UI::get ( nbins, set, "nbins", UI::optional ); |
| 32 | UI::get ( nsamples, set, "nsamples", UI::optional ); |
| 33 | UI::get ( R, set, "R", UI::optional ); |
| 34 | |
| 35 | mrv = UI::build<RV> ( set, "marginal_rv", UI::optional ); |
120 | | actual( tc ) = emu; |
121 | | ++tc; |
122 | | } while ( ( tc < CurrentContext::max_trial_count ) && |
123 | | !UnitTest::AreClose ( mean, actual( tc - 1 ), tolerance ) ); |
124 | | if ( ( tc == CurrentContext::max_trial_count ) && |
125 | | ( !UnitTest::AreClose ( mean, actual( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { |
126 | | UnitTest::MemoryOutStream stream; |
127 | | stream << CurrentContext::format_context(__LINE__) << "expected " << mean << " +/- " << tolerance << " but was " << actual; |
128 | | |
129 | | UnitTest::TestDetails details(*UnitTest::CurrentTest::Details(), 0, false); |
130 | | |
131 | | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
132 | | } |
| 120 | actual ( tc ) = emu; |
| 121 | ++tc; |
| 122 | } while ( ( tc < CurrentContext::max_trial_count ) && |
| 123 | !UnitTest::AreClose ( mean, actual ( tc - 1 ), tolerance ) ); |
| 124 | if ( ( tc == CurrentContext::max_trial_count ) && |
| 125 | ( !UnitTest::AreClose ( mean, actual ( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { |
| 126 | UnitTest::MemoryOutStream stream; |
| 127 | stream << CurrentContext::format_context ( __LINE__ ) << "expected " << mean << " +/- " << tolerance << " but was " << actual; |
| 128 | |
| 129 | UnitTest::TestDetails details ( *UnitTest::CurrentTest::Details(), 0, false ); |
| 130 | |
| 131 | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
| 132 | } |
143 | | actual( tc ) = nc; |
144 | | ++tc; |
145 | | } while ( ( tc < CurrentContext::max_trial_count ) && |
146 | | !UnitTest::AreClose ( 1.0, actual( tc - 1 ), tolerance ) ); |
147 | | if ( ( tc == CurrentContext::max_trial_count ) && |
148 | | ( !UnitTest::AreClose ( 1.0, actual( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { |
149 | | UnitTest::MemoryOutStream stream; |
150 | | stream << CurrentContext::format_context(__LINE__) << "expected " << mean << " +/- " << tolerance << " but was " << actual; |
151 | | |
152 | | UnitTest::TestDetails details(*UnitTest::CurrentTest::Details(), 0, false); |
153 | | |
154 | | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
155 | | } |
| 143 | actual ( tc ) = nc; |
| 144 | ++tc; |
| 145 | } while ( ( tc < CurrentContext::max_trial_count ) && |
| 146 | !UnitTest::AreClose ( 1.0, actual ( tc - 1 ), tolerance ) ); |
| 147 | if ( ( tc == CurrentContext::max_trial_count ) && |
| 148 | ( !UnitTest::AreClose ( 1.0, actual ( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { |
| 149 | UnitTest::MemoryOutStream stream; |
| 150 | stream << CurrentContext::format_context ( __LINE__ ) << "expected " << mean << " +/- " << tolerance << " but was " << actual; |
| 151 | |
| 152 | UnitTest::TestDetails details ( *UnitTest::CurrentTest::Details(), 0, false ); |
| 153 | |
| 154 | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
| 155 | } |
166 | | actual( tc ) = emu; |
167 | | ++tc; |
168 | | } while ( ( tc < CurrentContext::max_trial_count ) && |
169 | | !UnitTest::AreClose ( mean, actual( tc - 1 ), delta ) ); |
170 | | if ( ( tc == CurrentContext::max_trial_count ) && |
171 | | ( !UnitTest::AreClose ( mean, actual( CurrentContext::max_trial_count - 1 ), delta ) ) ) { |
172 | | UnitTest::MemoryOutStream stream; |
173 | | stream << CurrentContext::format_context(__LINE__) << "expected " << mean << " +/- " << delta << " but was " << actual; |
174 | | |
175 | | UnitTest::TestDetails details(*UnitTest::CurrentTest::Details(), 0, false); |
176 | | |
177 | | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
178 | | } |
| 166 | actual ( tc ) = emu; |
| 167 | ++tc; |
| 168 | } while ( ( tc < CurrentContext::max_trial_count ) && |
| 169 | !UnitTest::AreClose ( mean, actual ( tc - 1 ), delta ) ); |
| 170 | if ( ( tc == CurrentContext::max_trial_count ) && |
| 171 | ( !UnitTest::AreClose ( mean, actual ( CurrentContext::max_trial_count - 1 ), delta ) ) ) { |
| 172 | UnitTest::MemoryOutStream stream; |
| 173 | stream << CurrentContext::format_context ( __LINE__ ) << "expected " << mean << " +/- " << delta << " but was " << actual; |
| 174 | |
| 175 | UnitTest::TestDetails details ( *UnitTest::CurrentTest::Details(), 0, false ); |
| 176 | |
| 177 | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
| 178 | } |
188 | | actual( tc ) = er; |
189 | | ++tc; |
190 | | } while ( ( tc < CurrentContext::max_trial_count ) && |
191 | | !UnitTest::AreClose ( R, actual( tc - 1 ), tolerance ) ); |
192 | | |
193 | | if ( ( tc == CurrentContext::max_trial_count ) && |
194 | | ( !UnitTest::AreClose ( R, actual( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { |
195 | | UnitTest::MemoryOutStream stream; |
196 | | stream << CurrentContext::format_context(__LINE__) << "expected " << R << " +/- " << tolerance << " but was " << actual; |
197 | | |
198 | | UnitTest::TestDetails details(*UnitTest::CurrentTest::Details(), 0, false); |
199 | | |
200 | | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
201 | | } |
202 | | } |
203 | | |
204 | | void epdf_harness::check_cond_mean( mprod &mep ) { |
| 188 | actual ( tc ) = er; |
| 189 | ++tc; |
| 190 | } while ( ( tc < CurrentContext::max_trial_count ) && |
| 191 | !UnitTest::AreClose ( R, actual ( tc - 1 ), tolerance ) ); |
| 192 | |
| 193 | if ( ( tc == CurrentContext::max_trial_count ) && |
| 194 | ( !UnitTest::AreClose ( R, actual ( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { |
| 195 | UnitTest::MemoryOutStream stream; |
| 196 | stream << CurrentContext::format_context ( __LINE__ ) << "expected " << R << " +/- " << tolerance << " but was " << actual; |
| 197 | |
| 198 | UnitTest::TestDetails details ( *UnitTest::CurrentTest::Details(), 0, false ); |
| 199 | |
| 200 | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | void epdf_harness::check_cond_mean ( mprod &mep ) { |
212 | | actual( tc ) = emu; |
213 | | ++tc; |
214 | | } while ( ( tc < CurrentContext::max_trial_count ) && |
215 | | !UnitTest::AreClose ( mean, actual( tc - 1 ), delta ) ); |
216 | | if ( ( tc == CurrentContext::max_trial_count ) && |
217 | | ( !UnitTest::AreClose ( mean, actual( CurrentContext::max_trial_count - 1 ), delta ) ) ) { |
218 | | UnitTest::MemoryOutStream stream; |
219 | | stream << CurrentContext::format_context(__LINE__) << "expected " << mean << " +/- " << delta << " but was " << actual; |
220 | | |
221 | | UnitTest::TestDetails details(*UnitTest::CurrentTest::Details(), 0, false); |
222 | | |
223 | | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
224 | | } |
225 | | } |
226 | | |
227 | | void epdf_harness::check_cond_covariance( mprod &mep ) { |
228 | | int tc = 0; |
229 | | Array<mat> actual(CurrentContext::max_trial_count); |
| 212 | actual ( tc ) = emu; |
| 213 | ++tc; |
| 214 | } while ( ( tc < CurrentContext::max_trial_count ) && |
| 215 | !UnitTest::AreClose ( mean, actual ( tc - 1 ), delta ) ); |
| 216 | if ( ( tc == CurrentContext::max_trial_count ) && |
| 217 | ( !UnitTest::AreClose ( mean, actual ( CurrentContext::max_trial_count - 1 ), delta ) ) ) { |
| 218 | UnitTest::MemoryOutStream stream; |
| 219 | stream << CurrentContext::format_context ( __LINE__ ) << "expected " << mean << " +/- " << delta << " but was " << actual; |
| 220 | |
| 221 | UnitTest::TestDetails details ( *UnitTest::CurrentTest::Details(), 0, false ); |
| 222 | |
| 223 | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | void epdf_harness::check_cond_covariance ( mprod &mep ) { |
| 228 | int tc = 0; |
| 229 | Array<mat> actual ( CurrentContext::max_trial_count ); |
234 | | actual( tc ) = er; |
235 | | ++tc; |
236 | | } while ( ( tc < CurrentContext::max_trial_count ) && |
237 | | !UnitTest::AreClose ( R, actual( tc - 1 ), tolerance ) ); |
238 | | if ( ( tc == CurrentContext::max_trial_count ) && |
239 | | ( !UnitTest::AreClose ( R, actual( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { |
240 | | UnitTest::MemoryOutStream stream; |
241 | | stream << CurrentContext::format_context(__LINE__) << "expected " << mean << " +/- " << tolerance << " but was " << actual; |
242 | | |
243 | | UnitTest::TestDetails details(*UnitTest::CurrentTest::Details(), 0, false); |
244 | | |
245 | | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
246 | | } |
247 | | } |
248 | | |
249 | | } |
| 234 | actual ( tc ) = er; |
| 235 | ++tc; |
| 236 | } while ( ( tc < CurrentContext::max_trial_count ) && |
| 237 | !UnitTest::AreClose ( R, actual ( tc - 1 ), tolerance ) ); |
| 238 | if ( ( tc == CurrentContext::max_trial_count ) && |
| 239 | ( !UnitTest::AreClose ( R, actual ( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { |
| 240 | UnitTest::MemoryOutStream stream; |
| 241 | stream << CurrentContext::format_context ( __LINE__ ) << "expected " << mean << " +/- " << tolerance << " but was " << actual; |
| 242 | |
| 243 | UnitTest::TestDetails details ( *UnitTest::CurrentTest::Details(), 0, false ); |
| 244 | |
| 245 | UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | } |