Ignore:
Timestamp:
May 23, 2014, 3:42:51 PM (9 years ago)
Author:
Peter
Message:

BH correction on unsorted range. closes #796

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/statistics.cc

    r3137 r3236  
    4848using namespace theplu::yat;
    4949void test_benjamini_hochberg(test::Suite&);
     50void test_benjamini_hochberg_unsorted(test::Suite&);
    5051void test_entropy(test::Suite&);
    5152void test_mad(test::Suite&);
     
    135136  }
    136137  test_benjamini_hochberg(suite);
     138  test_benjamini_hochberg_unsorted(suite);
    137139  test_entropy(suite);
    138140  test_median_empty(suite);
     
    168170
    169171
     172void test_benjamini_hochberg_unsorted(test::Suite& suite)
     173{
     174  std::vector<double> p;
     175  p.push_back(0.015);
     176  p.push_back(0.0001);
     177  p.push_back(0.01);
     178  p.push_back(0.5);
     179  p.push_back(0.99);
     180  std::vector<double> q(p.size());
     181  statistics::benjamini_hochberg_unsorted(p.begin(), p.end(), q.begin());
     182  suite.add(suite.equal(q[1], p[1]*5));
     183  suite.add(suite.equal(q[2], p[2]*2.5));
     184  suite.add(suite.equal(q[0], 0.025));
     185  suite.add(suite.equal(q[3], p[3]*1.25));
     186  suite.add(suite.equal(q[4], 0.99));
     187
     188  // do nut run compiler test
     189  if (false) {
     190    using statistics::benjamini_hochberg_unsorted;
     191    boost::random_access_iterator_archetype<double> input;
     192    boost::mutable_random_access_iterator_archetype<double> result;
     193    benjamini_hochberg_unsorted(input, input, result);
     194  }
     195}
     196
     197
    170198void test_entropy(test::Suite& suite)
    171199{
Note: See TracChangeset for help on using the changeset viewer.