//------------------------------------------------------------------------- // proper end-to-end tests are elsewhere public virtual void test_parameterSensitivity() { SimplePriceIndexValues test = SimplePriceIndexValues.of(US_CPI_U, VAL_DATE, CURVE_NOFIX, USCPI_TS); InflationRateSensitivity point = InflationRateSensitivity.of(PriceIndexObservation.of(US_CPI_U, VAL_MONTH.plusMonths(3)), 1d); assertEquals(test.parameterSensitivity(point).size(), 1); }
public virtual void test_value_parameter_sensitivity_futfixing() { for (int i = 0; i < TEST_MONTHS.Length; i++) { YearMonth fixingMonth = TEST_OBS[i].FixingMonth; if (!fixingMonth.isBefore(YearMonth.from(VAL_DATE_2)) && !USCPI_TS.containsDate(fixingMonth.atEndOfMonth())) { InflationRateSensitivity ptsExpected = (InflationRateSensitivity)InflationRateSensitivity.of(TEST_OBS[i], 1d); CurrencyParameterSensitivities psComputed = INSTANCE_WITH_FUTFIXING.parameterSensitivity(ptsExpected); double x = YearMonth.from(VAL_DATE_2).until(fixingMonth, MONTHS); UnitParameterSensitivities sens1 = UnitParameterSensitivities.of(CURVE_INFL2.yValueParameterSensitivity(x)); CurrencyParameterSensitivities psExpected = sens1.multipliedBy(ptsExpected.Currency, ptsExpected.Sensitivity); assertTrue(psComputed.equalWithTolerance(psExpected, TOLERANCE_DELTA), "test " + i); } } }