Beispiel #1
0
		Fixture() {
			BOOST_TEST_MESSAGE( "Setting up test sets and reference points " );
			m_refPoint3D = boost::assign::list_of( 1.1 )( 1.1 )( 1.1 );
			m_testSet3D.push_back( boost::assign::list_of( 6.56039859404455e-2 ) (0.4474014917277) (0.891923776019316) );
			m_testSet3D.push_back( boost::assign::list_of( 3.74945443950542e-2)(3.1364039802686e-2)(0.998804513479922 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.271275894554688)(0.962356894778677)(1.66911984440026e-2 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.237023460537611)(0.468951509833942)(0.850825693417425 ) );
			m_testSet3D.push_back( boost::assign::list_of( 8.35813910785332e-2)(0.199763306732937)(0.97627289850149 ) );
			m_testSet3D.push_back( boost::assign::list_of( 1.99072649788403e-2)(0.433909411793732)(0.900736544810901 ) );
			m_testSet3D.push_back( boost::assign::list_of( 9.60698311356187e-2)(0.977187045721721)(0.18940978121319 ) );
			m_testSet3D.push_back( boost::assign::list_of( 2.68052822856208e-2)(2.30651870780559e-2)(0.999374541394087 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.356223209018184)(0.309633114503212)(0.881607826507812 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.127964409429531)(0.73123479272024)(0.670015513129912 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.695473366395562)(0.588939459338073)(0.411663831140169 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.930735605917613)(0.11813654121718)(0.346085234453039 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.774030940645471)(2.83363630460836e-2)(0.632513362272141 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.882561783965009)(4.80931050853475e-3)(0.470171849451808 ) );
			m_testSet3D.push_back( boost::assign::list_of( 4.92340623346446e-3)(0.493836329534438)(0.869540936185878 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.305054163869799)(0.219367569077876)(0.926725324323535 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.575227233936948)(0.395585597387712)(0.715978815661927 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.914091673974525)(0.168988399705031)(0.368618138912863 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.225088318852838)(0.796785147906617)(0.560775067911755 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.306941172015014)(0.203530333828304)(0.929710987422322 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.185344081015371)(0.590388202293731)(0.785550343533082 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.177181921358634)(0.67105558509432)(0.719924279669315 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.668494587335475)(0.22012845825454)(0.710393164782469 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.768639363955671)(0.256541291890516)(0.585986427942633 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.403457020846225)(0.744309886218013)(0.532189088208334 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.659545359568811)(0.641205442223306)(0.39224418355721 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.156141960251846)(8.36191498217669e-2)(0.984188765446851 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.246039496399399)(0.954377757574506)(0.16919711007753 ) );
			m_testSet3D.push_back( boost::assign::list_of( 3.02243260456876e-2)(0.43842801306405)(0.898257962656493 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.243139979715573)(0.104253945099703)(0.96437236853565 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.343877707314699)(0.539556201272222)(0.768522757034998 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.715293885551218)(0.689330705208567)(0.114794756629825 ) );
			m_testSet3D.push_back( boost::assign::list_of( 1.27610149409238e-2)(9.47996983636579e-2)(0.995414573777096 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.30565381275615)(0.792827267212719)(0.527257689476066 ) );
			m_testSet3D.push_back( boost::assign::list_of( 0.43864576057661)(3.10389339442242e-2)(0.8981238674636 ) );

			m_refPoint2D = boost::assign::list_of( 11 )( 11 );
			m_testSet2D.push_back( boost::assign::list_of( 0.0000000000 )(1.0000000000 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.1863801385)(0.9824777066 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.2787464911)(0.9603647191 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.3549325314)(0.9348919179 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.4220279525)(0.9065828188 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.4828402120)(0.8757084730 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.5388359009)(0.8424107501 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.5908933491)(0.8067496824 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.6395815841)(0.7687232254 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.6852861036)(0.7282739568 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.7282728148)(0.6852873173 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.7687221637)(0.6395828601 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.8067485614)(0.5908948796 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.8424097574)(0.5388374529 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.8757076053)(0.4828417856 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.9065821569)(0.4220293744 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.9348914021)(0.3549338901 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.9603643728)(0.2787476843 ) );
			m_testSet2D.push_back( boost::assign::list_of( 0.9824775804)(0.1863808035 ) );
			m_testSet2D.push_back( boost::assign::list_of( 1.0000000000)(0.0000000000 ) );
		}
Beispiel #2
0
 SortingFixture() : array(new int[array_size]) { parallel::init(3); reset(); BOOST_TEST_MESSAGE( "setup fixture" ); }
Beispiel #3
0
 Fixture()
     : application(boost::unit_test::framework::master_test_suite().argc,
                   boost::unit_test::framework::master_test_suite().argv)
 {
     BOOST_TEST_MESSAGE( "setup QCoreApplication fixture" );
 }
 ~CNormalizeStringTestSetup () {
   BOOST_TEST_MESSAGE("tear-down utf8 string normalize test");
 }
 void teardown() {
     BOOST_TEST_MESSAGE( "teardown fixture i=" << i );
     i += 2;
 }
 Massive() : m(2)
 {
     BOOST_TEST_MESSAGE("setup mass");
 }
 ~F()         { BOOST_TEST_MESSAGE( "teardown fixture" ); }
 ~CStringBufferSetup () {
   BOOST_TEST_MESSAGE("tear-down TRI_string_buffer_t");
 }
Beispiel #9
0
 suite_fixture()     { BOOST_TEST_MESSAGE( "Running some test suite setup" ); }
 ~CAssociativePointerSetup () {
   BOOST_TEST_MESSAGE("tear-down TRI_associative_pointer_t");
 }
Beispiel #11
0
 CStringBufferSetup () {
   BOOST_TEST_MESSAGE("setup TRI_string_buffer_t");
 }
 CAssociativePointerSetup () {
   BOOST_TEST_MESSAGE("setup TRI_associative_pointer_t");
 }
 CNormalizeStringTestSetup () {
   BOOST_TEST_MESSAGE("setup utf8 string normalize test");
 }
Beispiel #14
0
 ~setDietEnvFixture() {
   BOOST_TEST_MESSAGE("== Test teardown [BEGIN]: unsetting environment ==");
   BOOST_TEST_MESSAGE("== Test teardown [END]: unsetting environment ==");
 }
 ~VPackHelperSetup () {
   BOOST_TEST_MESSAGE("tear-down VelocyPackHelper test");
 }
Beispiel #16
0
 ~suite_fixture()    { BOOST_TEST_MESSAGE( "Running some test suite teardown" ); }
 ~Massive()
 {
     BOOST_TEST_MESSAGE("teardown mass");
 }
Beispiel #18
0
void some_setup()
{
    BOOST_TEST_MESSAGE( "Running some extra setup" );
}
 F() : i( 0 ) { BOOST_TEST_MESSAGE( "setup fixture" ); }
Beispiel #20
0
void StandardExceptionTranslator( const std::exception& e )
{
    BOOST_TEST_MESSAGE( e.what() );
}
Beispiel #21
0
 ~TestRandom() { BOOST_TEST_MESSAGE("Tear down random number generator"); }
Beispiel #22
0
/**
 * Test generation of permutation using halmd::radix_sort on GPU.
 */
static void test_permutation_gpu(int count, int repeat)
{
    std::vector<unsigned int> input_key = make_uniform_array(count);
    cuda::vector<unsigned int> g_input_key(count);
    BOOST_CHECK( cuda::copy(
        input_key.begin()
      , input_key.end()
      , g_input_key.begin()) == g_input_key.end()
    );
    std::vector<unsigned int> result(input_key.begin(), input_key.end());
    std::sort(result.begin(), result.end());

    std::vector<unsigned int> input_value(count);
    std::iota(input_value.begin(), input_value.end(), 0);
    cuda::vector<unsigned int> g_input_value(count);
    BOOST_CHECK( cuda::copy(
        input_value.begin()
      , input_value.end()
      , g_input_value.begin()) == g_input_value.end()
    );

    BOOST_TEST_MESSAGE( "  " << count << " elements" );
    BOOST_TEST_MESSAGE( "  " << repeat << " iterations" );

    halmd::accumulator<double> elapsed;
    for (int i = 0; i < repeat; ++i) {
        cuda::vector<unsigned int> g_output_key(count);
        BOOST_CHECK( cuda::copy(
            g_input_key.begin()
          , g_input_key.end()
          , g_output_key.begin()) == g_output_key.end()
        );

        cuda::vector<unsigned int> g_output_value(count);
        BOOST_CHECK( cuda::copy(
            g_input_value.begin()
          , g_input_value.end()
          , g_output_value.begin()) == g_output_value.end()
        );

        {
            halmd::scoped_timer<halmd::timer> t(elapsed);
            BOOST_CHECK( halmd::radix_sort(
                g_output_key.begin()
              , g_output_key.end()
              , g_output_value.begin()) == g_output_value.end()
            );
        }

        cuda::host::vector<unsigned int> h_output_key(count);
        BOOST_CHECK( cuda::copy(
            g_output_key.begin()
          , g_output_key.end()
          , h_output_key.begin()) == h_output_key.end()
        );
        BOOST_CHECK_EQUAL_COLLECTIONS(
            h_output_key.begin()
          , h_output_key.end()
          , result.begin()
          , result.end()
        );

        cuda::host::vector<unsigned int> h_output_value(count);
        BOOST_CHECK( cuda::copy(
            g_output_value.begin()
          , g_output_value.end()
          , h_output_value.begin()) == h_output_value.end()
        );
        auto value_to_key = [&](unsigned int value) {
            return input_key[value];
        };
        BOOST_CHECK_EQUAL_COLLECTIONS(
            boost::make_transform_iterator(h_output_value.begin(), value_to_key)
          , boost::make_transform_iterator(h_output_value.end(), value_to_key)
          , result.begin()
          , result.end()
        );
    }
    BOOST_TEST_MESSAGE( "  " << mean(elapsed) * 1e3 << " ± " << error_of_mean(elapsed) * 1e3 << " ms per iteration" );
}
 void setup() {
     BOOST_TEST_MESSAGE( "setup fixture i=" << i );
     i++;
 }
Beispiel #24
0
 mas_edge_connectivity_visitor(const mas_edge_connectivity_visitor<Graph, KeyedUpdatablePriorityQueue>& r)
   : m_pq(r.m_pq), m_curr(r.m_curr), m_prev(r.m_prev), 
     m_reach_weight(r.m_reach_weight) {
       BOOST_TEST_MESSAGE( "COPY CTOR" );
     }
 ~MyGlobalFixture() {
     BOOST_TEST_MESSAGE( "dtor fixture i=" << i );
 }
Beispiel #26
0
 ~PermFixture()         { BOOST_TEST_MESSAGE( "teardown fixture" ); }
Beispiel #27
0
 ~SortingFixture() { parallel::close(); delete[] array; BOOST_TEST_MESSAGE( "teardown fixture" ); }
 VPackHelperSetup () {
   BOOST_TEST_MESSAGE("setup VelocyPackHelper test");
 }
Beispiel #29
0
 ~Fixture()
 {
     BOOST_TEST_MESSAGE( "teardown QCoreApplication fixture" );
 }
void InflationVolTest::testYoYPriceSurfaceToVol() {
    BOOST_TEST_MESSAGE("Testing conversion from YoY price surface "
                       "to YoY volatility surface...");

    SavedSettings backup;

    setup();

    // first get the price surface set up
    setupPriceSurface();

    // caplet pricer, recall that setCapletVolatility(Handle<YoYOptionletVolatilitySurface>)
    // exists ... we'll use it with the -Curve variant of the surface
    // test UNIT DISPLACED pricer
    boost::shared_ptr<YoYOptionletVolatilitySurface> pVS;
    Handle<YoYOptionletVolatilitySurface> hVS(pVS, false); // pVS does NOT own whatever it points to later, hence the handle does not either
    boost::shared_ptr<YoYInflationUnitDisplacedBlackCapFloorEngine>
        yoyPricerUD(new YoYInflationUnitDisplacedBlackCapFloorEngine(yoyIndexEU,hVS)); //hVS
    // N.B. the vol gets set in the stripper ... else no point!

    // cap stripper
    boost::shared_ptr<YoYOptionletStripper> yoyOptionletStripper(
                             new InterpolatedYoYOptionletStripper<Linear>() );

    // now set up all the variables for the stripping
    Natural settlementDays = 0;
    TARGET cal;
    BusinessDayConvention bdc = ModifiedFollowing;
    DayCounter dc = Actual365Fixed();

    boost::shared_ptr<YoYCapFloorTermPriceSurface> capFloorPrices = priceSurfEU;
    Period lag = priceSurfEU->observationLag();

    Real slope = -0.5; //when you have bad data, i.e. very low/constant
    //prices for short dated extreem strikes
    //then you cannot assume constant caplet vol
    //(else arbitrage)
    // N.B. if this is too extreme then can't
    // get a no-arbitrage solution anyway
    // the way the slope is used means that the slope is
    // proportional to the level so higher slopes at
    // the edges when things are more volatile

    // Actually is doesn't matter what the interpolation is because we only
    // intend to use the K values that correspond to quotes ... for model fitting.
    boost::shared_ptr<KInterpolatedYoYOptionletVolatilitySurface<Linear> > yoySurf(new
                    KInterpolatedYoYOptionletVolatilitySurface<Linear>(settlementDays,
                cal, bdc, dc, lag, capFloorPrices, yoyPricerUD, yoyOptionletStripper,
                                                              slope) );

    // now use it for something ... like stating what the T=const lines look like
    const Real volATyear1[] = {
          0.0128, 0.0093, 0.0083, 0.0073, 0.0064,
          0.0058, 0.0042, 0.0046, 0.0053, 0.0064,
          0.0098
    };
    const Real volATyear3[] = {
          0.0079, 0.0058, 0.0051, 0.0045, 0.0039,
          0.0035, 0.0026, 0.0028, 0.0033, 0.0039,
          0.0060
    };

    Date d = yoySurf->baseDate() + Period(1,Years);
    pair<vector<Rate>, vector<Volatility> > someSlice;
    someSlice = yoySurf->Dslice(d);

    Size n = someSlice.first.size();
    Real eps = 0.0001;
    for(Size i = 0; i < n; i++){
        QL_REQUIRE( fabs(someSlice.second[i] - volATyear1[i]) < eps,
                   " could not recover 1yr vol: " << someSlice.second[i]
                   << " vs " << volATyear1[i] );
    }

    d = yoySurf->baseDate() + Period(3,Years);
    pair<vector<Rate>, vector<Volatility> >
        someOtherSlice = yoySurf->Dslice(d);
    n = someOtherSlice.first.size();
    for(Size i = 0; i < n; i++){
        QL_REQUIRE(fabs(someOtherSlice.second[i]-volATyear3[i]) < eps,
                        "could not recover 3yr vol: "
                        << someOtherSlice.second[i]<< " vs " << volATyear3[i] );
    }

    reset();
}