diff --git a/QLNet.sln b/QLNet.sln index 2b68497a2..0dab30b5d 100644 --- a/QLNet.sln +++ b/QLNet.sln @@ -1,26 +1,38 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QLNet", "QLNet\QLNet.csproj", "{F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{2EF8B45B-940A-4B77-8776-E8CE0036961E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Release|Any CPU.Build.0 = Release|Any CPU - {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QLNet", "QLNet\QLNet.csproj", "{F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{2EF8B45B-940A-4B77-8776-E8CE0036961E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug-net45|Any CPU = Debug-net45|Any CPU + Release|Any CPU = Release|Any CPU + Release-net45|Any CPU = Release-net45|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Debug-net45|Any CPU.ActiveCfg = Debug-net45|Any CPU + {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Debug-net45|Any CPU.Build.0 = Debug-net45|Any CPU + {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Release|Any CPU.Build.0 = Release|Any CPU + {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Release-net45|Any CPU.ActiveCfg = Release-net45|Any CPU + {F6E762BD-DCDF-4CA0-ABAD-CB21C7D03BEC}.Release-net45|Any CPU.Build.0 = Release-net45|Any CPU + {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Debug-net45|Any CPU.ActiveCfg = Debug-net45|Any CPU + {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Debug-net45|Any CPU.Build.0 = Debug-net45|Any CPU + {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Release|Any CPU.Build.0 = Release|Any CPU + {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Release-net45|Any CPU.ActiveCfg = Release-net45|Any CPU + {2EF8B45B-940A-4B77-8776-E8CE0036961E}.Release-net45|Any CPU.Build.0 = Release-net45|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/QLNet/Properties/AssemblyInfo.cs b/QLNet/Properties/AssemblyInfo.cs index d048384f1..28ccd96bb 100644 --- a/QLNet/Properties/AssemblyInfo.cs +++ b/QLNet/Properties/AssemblyInfo.cs @@ -30,5 +30,5 @@ // // È possibile specificare tutti i valori o impostare come predefiniti i valori Numero revisione e Numero build // utilizzando l'asterisco (*) come descritto di seguito: -[assembly: AssemblyVersion( "1.9.0.0" )] -[assembly: AssemblyFileVersion( "1.9.0.0" )] +[assembly: AssemblyVersion( "1.9.1.0" )] +[assembly: AssemblyFileVersion( "1.9.1.0" )] diff --git a/QLNet/QLNet.csproj b/QLNet/QLNet.csproj index 2f023ed66..2a24cadcf 100644 --- a/QLNet/QLNet.csproj +++ b/QLNet/QLNet.csproj @@ -37,7 +37,7 @@ true full false - bin\Debug\ + bin\Debug\net40\ TRACE;DEBUG;QL_NEGATIVE_RATES,QL_DOTNET_FRAMEWORK prompt 4 @@ -48,13 +48,33 @@ pdbonly true - bin\Release\ + bin\Release\net40\ TRACE;QL_NEGATIVE_RATES,QL_DOTNET_FRAMEWORK prompt 4 AllRules.ruleset false + + true + bin\Debug\net45\ + TRACE;DEBUG;QL_NEGATIVE_RATES,QL_DOTNET_FRAMEWORK + full + v4.5 + AnyCPU + prompt + AllRules.ruleset + + + bin\Release\net45\ + TRACE;QL_NEGATIVE_RATES,QL_DOTNET_FRAMEWORK + true + pdbonly + v4.5 + AnyCPU + prompt + AllRules.ruleset + @@ -699,5 +719,5 @@ - --> +--> \ No newline at end of file diff --git a/QLNet/QLNet.nuspec b/QLNet/QLNet.nuspec index 0c1c0f567..dc3b04eea 100644 --- a/QLNet/QLNet.nuspec +++ b/QLNet/QLNet.nuspec @@ -2,7 +2,7 @@ QLNet - $version$ + 1.9.1.0 QLNet Andrea Maggiulli Andrea Maggiulli @@ -10,8 +10,13 @@ http://github.com/amaggiulli/qlnet false A free/open-source library for quantitative finance - Version $version$ - Copyright (c) 2008-2014 Andrea Maggiulli (a.maggiulli@gmail.com) + Version 1.9.1.0 + Copyright (c) 2008-2017 Andrea Maggiulli (a.maggiulli@gmail.com) QLNet QuantLib quantitative finance financial + + + + + \ No newline at end of file diff --git a/QLNet/project.json b/QLNet/project.json index 2ea514332..b2d109af5 100644 --- a/QLNet/project.json +++ b/QLNet/project.json @@ -1,5 +1,5 @@ { - "version": "1.8.0-*", + "version": "1.9.1-*", "dependencies": { "NETStandard.Library": "1.6.0" diff --git a/Test/Properties/AssemblyInfo.cs b/Test/Properties/AssemblyInfo.cs index ca1991865..c515943af 100644 --- a/Test/Properties/AssemblyInfo.cs +++ b/Test/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ // // È possibile specificare tutti i valori oppure impostare i valori predefiniti per i numeri relativi alla build e alla revisione // utilizzando l'asterisco (*) come descritto di seguito: -[assembly: AssemblyVersion( "1.9.0.0" )] +[assembly: AssemblyVersion( "1.9.1.0" )] [assembly: AssemblyFileVersion( "1.9.0.0" )] diff --git a/Test/T_BarrierOption.cs b/Test/T_BarrierOption.cs index be78749ea..3f4c0ea37 100644 --- a/Test/T_BarrierOption.cs +++ b/Test/T_BarrierOption.cs @@ -764,7 +764,7 @@ public void testLocalVolAndHestonComparison() if (Math.Abs(expectedHestonNPV - calculatedHestonNPV) > tol*expectedHestonNPV) { - Assert.Fail("Failed to reproduce Heston barrier price for " + QAssert.Fail("Failed to reproduce Heston barrier price for " + "\n strike: " + payoff.strike() + "\n barrier: " + barrier + "\n maturity: " + exDate @@ -773,7 +773,7 @@ public void testLocalVolAndHestonComparison() } if (Math.Abs(expectedLocalVolNPV - calculatedLocalVolNPV) > tol*expectedLocalVolNPV) { - Assert.Fail("Failed to reproduce Heston barrier price for " + QAssert.Fail("Failed to reproduce Heston barrier price for " + "\n strike: " + payoff.strike() + "\n barrier: " + barrier + "\n maturity: " + exDate diff --git a/Test/T_BlackDeltaCalculator.cs b/Test/T_BlackDeltaCalculator.cs index 3a03c34e5..c2a536c00 100644 --- a/Test/T_BlackDeltaCalculator.cs +++ b/Test/T_BlackDeltaCalculator.cs @@ -149,7 +149,7 @@ public void testDeltaValues() if (error>tolerance) { - Assert.Fail("\n Delta-from-strike calculation failed for delta. \n" + QAssert.Fail("\n Delta-from-strike calculation failed for delta. \n" + "Iteration: "+ i + "\n" + "Calculated Strike:" + calculated + "\n" + "Expected Strike:" + expected + "\n" @@ -167,7 +167,7 @@ public void testDeltaValues() if (error>tolerance) { - Assert.Fail("\n Strike-from-delta calculation failed for delta. \n" + QAssert.Fail("\n Strike-from-delta calculation failed for delta. \n" + "Iteration: "+ i + "\n" + "Calculated Strike:" + calculated + "\n" + "Expected Strike:" + expected + "\n" @@ -292,7 +292,7 @@ public void testDeltaPriceConsistency() if(error>tolerance) { - Assert.Fail("\n Premium-adjusted spot delta test failed. \n" + QAssert.Fail("\n Premium-adjusted spot delta test failed. \n" + "Calculated Delta: " + calculatedVal + "\n" + "Expected Value: " + expectedVal + "\n" + "Error: "+ error); @@ -306,7 +306,7 @@ public void testDeltaPriceConsistency() if(error>tolerance) { - Assert.Fail("\n Premium-adjusted forward delta test failed. \n" + QAssert.Fail("\n Premium-adjusted forward delta test failed. \n" + "Calculated Delta: " + calculatedVal + "\n" + "Expected Value: " + expectedVal + "\n" + "Error: "+ error); @@ -322,7 +322,7 @@ public void testDeltaPriceConsistency() if(error>tolerance) { - Assert.Fail("\n spot delta in BlackDeltaCalculator differs from delta in BlackScholesCalculator. \n" + QAssert.Fail("\n spot delta in BlackDeltaCalculator differs from delta in BlackScholesCalculator. \n" + "Calculated Value: " + calculatedVal + "\n" + "Expected Value: " + expectedVal + "\n" + "Error: " + error); @@ -461,7 +461,7 @@ public void testPutCallParity() if(error>tolerance) { - Assert.Fail("\n Put-call parity failed for spot delta. \n" + QAssert.Fail("\n Put-call parity failed for spot delta. \n" + "Calculated Call Delta: " + deltaCall + "\n" + "Calculated Put Delta: " + deltaPut + "\n" + "Expected Difference: " + expectedDiff + "\n" @@ -480,7 +480,7 @@ public void testPutCallParity() if(error>tolerance) { - Assert.Fail("\n Put-call parity failed for forward delta. \n" + QAssert.Fail("\n Put-call parity failed for forward delta. \n" + "Calculated Call Delta: " + deltaCall + "\n" + "Calculated Put Delta: " + deltaPut + "\n" + "Expected Difference: " + expectedDiff + "\n" @@ -500,7 +500,7 @@ public void testPutCallParity() if(error>tolerance) { - Assert.Fail("\n Put-call parity failed for premium-adjusted spot delta. \n" + QAssert.Fail("\n Put-call parity failed for premium-adjusted spot delta. \n" + "Calculated Call Delta: " + deltaCall + "\n" + "Calculated Put Delta: " + deltaPut + "\n" + "Expected Difference: " + expectedDiff + "\n" @@ -520,7 +520,7 @@ public void testPutCallParity() if(error>tolerance) { - Assert.Fail("\n Put-call parity failed for premium-adjusted forward delta. \n" + QAssert.Fail("\n Put-call parity failed for premium-adjusted forward delta. \n" + "Calculated Call Delta: " + deltaCall + "\n" + "Calculated Put Delta: " + deltaPut + "\n" + "Expected Difference: " + expectedDiff + "\n" @@ -599,7 +599,7 @@ public void testAtmCalcs() if(error>tolerance) { - Assert.Fail("\n Delta neutrality failed for spot delta in Delta Calculator. \n" + QAssert.Fail("\n Delta neutrality failed for spot delta in Delta Calculator. \n" + "Iteration: "+ i + "\n" + "Calculated Delta Sum: " + calculated + "\n" + "Expected Delta Sum: " + expected + "\n" @@ -619,7 +619,7 @@ public void testAtmCalcs() if(error>tolerance) { - Assert.Fail("\n Delta neutrality failed for forward delta in Delta Calculator. \n" + QAssert.Fail("\n Delta neutrality failed for forward delta in Delta Calculator. \n" + "Iteration: " + i + "\n" + "Calculated Delta Sum: " + calculated + "\n" + "Expected Delta Sum: " + expected + "\n" @@ -639,7 +639,7 @@ public void testAtmCalcs() if(error>tolerance) { - Assert.Fail("\n Delta neutrality failed for premium-adjusted spot delta in Delta Calculator. \n" + QAssert.Fail("\n Delta neutrality failed for premium-adjusted spot delta in Delta Calculator. \n" + "Iteration: " + i + "\n" + "Calculated Delta Sum: " + calculated + "\n" + "Expected Delta Sum: " + expected + "\n" @@ -660,7 +660,7 @@ public void testAtmCalcs() if(error>tolerance) { - Assert.Fail("\n Delta neutrality failed for premium-adjusted forward delta in Delta Calculator. \n" + QAssert.Fail("\n Delta neutrality failed for premium-adjusted forward delta in Delta Calculator. \n" + "Iteration: " + i + "\n" + "Calculated Delta Sum: " + calculated + "\n" + "Expected Delta Sum: " + expected + "\n" @@ -674,7 +674,7 @@ public void testAtmCalcs() if(error>tolerance) { - Assert.Fail("\n Atm forward test failed. \n" + QAssert.Fail("\n Atm forward test failed. \n" + "Calculated Value: " + calculated + "\n" + "Expected Value: " + expected + "\n" + "Error: " + error); @@ -689,7 +689,7 @@ public void testAtmCalcs() if(error>tolerance) { - Assert.Fail("\n Atm 0.50 delta strike test failed. \n" + QAssert.Fail("\n Atm 0.50 delta strike test failed. \n" + "Iteration:" + i + "\n" + "Calculated Value: " + calculated + "\n" + "Expected Value: " + expected + "\n" diff --git a/Test/T_BlackFormula.cs b/Test/T_BlackFormula.cs index 7c472d185..8e5a0c581 100644 --- a/Test/T_BlackFormula.cs +++ b/Test/T_BlackFormula.cs @@ -112,7 +112,7 @@ public void testChambersImpliedVol() if(moneyness > 1.0) moneyness = 1.0 / moneyness; double error = (iStdDev - stdDevs[i5]) / stdDevs[i5] * moneyness; if(error > tol) - Assert.Fail("Failed to verify Chambers-Nawalkha approximation for " + QAssert.Fail("Failed to verify Chambers-Nawalkha approximation for " + types[i1] + " displacement=" + displacements[i2] + " forward=" + forwards[i3] diff --git a/Test/T_CPISwap.cs b/Test/T_CPISwap.cs index 7dc7e9f65..41ab8ed9a 100644 --- a/Test/T_CPISwap.cs +++ b/Test/T_CPISwap.cs @@ -337,14 +337,14 @@ public void consistency() if (zicV != null) { diff = Math.Abs( zicV.rate() - (fixedRate*(zicV.indexFixing()/baseCPI)) ); - Assert.IsTrue(diff<1e-8, "failed "+i+"th coupon reconstruction as " + QAssert.IsTrue(diff<1e-8, "failed "+i+"th coupon reconstruction as " + (fixedRate*(zicV.indexFixing()/baseCPI)) + " vs rate = " +zicV.rate() + ", with difference: " + diff); } } double error = Math.Abs(testInfLegNPV - zisV.legNPV(0).Value); - Assert.IsTrue( error < 1e-5, "failed manual inf leg NPV calc vs pricing engine: " + testInfLegNPV + " vs " + + QAssert.IsTrue( error < 1e-5, "failed manual inf leg NPV calc vs pricing engine: " + testInfLegNPV + " vs " + zisV.legNPV(0)); diff = Math.Abs(1-zisV.NPV()/4191660.0); @@ -353,7 +353,7 @@ public void consistency() #else double max_diff = 3e-5; #endif - Assert.IsTrue( diff < max_diff, "failed stored consistency value test, ratio = " + diff ); + QAssert.IsTrue( diff < max_diff, "failed stored consistency value test, ratio = " + diff ); // remove circular refernce common.hcpi.linkTo(null); @@ -385,7 +385,7 @@ public void zciisconsistency() DiscountingSwapEngine dse = new DiscountingSwapEngine(common.nominalUK); zciis.setPricingEngine(dse); - Assert.IsTrue(Math.Abs(zciis.NPV())<1e-3,"zciis does not reprice to zero"); + QAssert.IsTrue(Math.Abs(zciis.NPV())<1e-3,"zciis does not reprice to zero"); List oneDate = new List(); oneDate.Add(endDate); @@ -408,13 +408,13 @@ public void zciisconsistency() common.ii, InterpolationType.AsIndex, inflationNominal); cS.setPricingEngine(dse); - Assert.IsTrue(Math.Abs(cS.NPV())<1e-3,"CPISwap as ZCIIS does not reprice to zero"); + QAssert.IsTrue(Math.Abs(cS.NPV())<1e-3,"CPISwap as ZCIIS does not reprice to zero"); for (int i=0; i<2; i++) { double cs = cS.legNPV(i).GetValueOrDefault(); double z = zciis.legNPV(i).GetValueOrDefault(); - Assert.IsTrue(Math.Abs(cs - z)<1e-3, "zciis leg does not equal CPISwap leg"); + QAssert.IsTrue(Math.Abs(cs - z)<1e-3, "zciis leg does not equal CPISwap leg"); } // remove circular refernce common.hcpi.linkTo(null); @@ -508,7 +508,7 @@ public void cpibondconsistency() DiscountingBondEngine dbe = new DiscountingBondEngine(common.nominalUK); cpiB.setPricingEngine(dbe); - Assert.IsTrue(Math.Abs(cpiB.NPV() - zisV.legNPV(0).GetValueOrDefault())<1e-5, + QAssert.IsTrue(Math.Abs(cpiB.NPV() - zisV.legNPV(0).GetValueOrDefault())<1e-5, "cpi bond does not equal equivalent cpi swap leg"); // remove circular refernce common.hcpi.linkTo(null); diff --git a/Test/T_Calendars.cs b/Test/T_Calendars.cs index 848a4576f..44aa933ad 100644 --- a/Test/T_Calendars.cs +++ b/Test/T_Calendars.cs @@ -178,7 +178,7 @@ public class T_Calendars { List hol = Calendar.holidayList(c, new Date(1, Month.January, 2004), new Date(31, Month.December, 2005)); if ( hol.Count != expectedHol.Count ) - Assert.Fail( "there were " + expectedHol.Count + QAssert.Fail( "there were " + expectedHol.Count + " expected holidays, while there are " + hol.Count + " calculated holidays" ); @@ -208,7 +208,7 @@ public class T_Calendars { for ( int i = 0; i < hol.Count; i++ ) { if ( hol[i] != expectedHol[i] ) - Assert.Fail( "expected holiday was " + expectedHol[i] + QAssert.Fail( "expected holiday was " + expectedHol[i] + " while calculated holiday is " + hol[i] ); } } @@ -1064,12 +1064,12 @@ public void testChinaSSE() for (int i = 0; i < Math.Min(hol.Count, expectedHol.Count); i++) { - if (hol[i] != expectedHol[i]) - Assert.Fail("expected holiday was " + expectedHol[i] + if (hol[i] != expectedHol[i]) + QAssert.Fail("expected holiday was " + expectedHol[i] + " while calculated holiday is " + hol[i]); } - if (hol.Count != expectedHol.Count) - Assert.Fail("there were " + expectedHol.Count + if (hol.Count != expectedHol.Count) + QAssert.Fail("there were " + expectedHol.Count + " expected holidays, while there are " + hol.Count + " calculated holidays"); } @@ -1117,7 +1117,7 @@ public void testChinaIB() if (c.isBusinessDay(start) && c.isWeekend(start.DayOfWeek)) { if (expectedWorkingWeekEnds[k] != start) - Assert.Fail("expected working weekend was " + expectedWorkingWeekEnds[k] + QAssert.Fail("expected working weekend was " + expectedWorkingWeekEnds[k] + " while calculated working weekend is " + start); ++k; } @@ -1125,7 +1125,7 @@ public void testChinaIB() } if (k != (expectedWorkingWeekEnds.Count)) - Assert.Fail("there were " + expectedWorkingWeekEnds.Count + QAssert.Fail("there were " + expectedWorkingWeekEnds.Count + " expected working weekends, while there are " + k + " calculated holidays"); } diff --git a/Test/T_CapFlooredCoupon.cs b/Test/T_CapFlooredCoupon.cs index 28b338035..06ddae4a4 100644 --- a/Test/T_CapFlooredCoupon.cs +++ b/Test/T_CapFlooredCoupon.cs @@ -190,7 +190,7 @@ public void testLargeRates() double npvCollar = collarLeg.NPV(); if ( Math.Abs( npvVanilla - npvCollar ) > tolerance ) { - Assert.Fail("Lenght: " + vars.length + " y" + "\n" + + QAssert.Fail("Lenght: " + vars.length + " y" + "\n" + "Volatility: " + vars.volatility*100 + "%\n" + "Notional: " + vars.nominal + "\n" + "Vanilla floating leg NPV: " + vanillaLeg.NPV() @@ -265,7 +265,7 @@ public void testDecomposition() error = Math.Abs(npvCappedLeg - (npvVanilla-npvCap)); if (error>tolerance) { - Assert.Fail("\nCapped Leg: gearing=1, spread=0%, strike=" + capstrike*100 + + QAssert.Fail("\nCapped Leg: gearing=1, spread=0%, strike=" + capstrike*100 + "%\n" + " Capped Floating Leg NPV: " + npvCappedLeg + "\n" + " Floating Leg NPV - Cap NPV: " + (npvVanilla - npvCap) + "\n" + @@ -290,7 +290,7 @@ public void testDecomposition() error = Math.Abs(npvFlooredLeg-(npvVanilla + npvFloor)); if (error>tolerance) { - Assert.Fail("Floored Leg: gearing=1, spread=0%, strike=" + floorstrike *100 + + QAssert.Fail("Floored Leg: gearing=1, spread=0%, strike=" + floorstrike *100 + "%\n" + " Floored Floating Leg NPV: " + npvFlooredLeg + "\n" + " Floating Leg NPV + Floor NPV: " + (npvVanilla + npvFloor) + "\n" + @@ -314,7 +314,7 @@ public void testDecomposition() error = Math.Abs(npvCollaredLeg -(npvVanilla - npvCollar)); if (error>tolerance) { - Assert.Fail("\nCollared Leg: gearing=1, spread=0%, strike=" + + QAssert.Fail("\nCollared Leg: gearing=1, spread=0%, strike=" + floorstrike*100 + "% and " + capstrike*100 + "%\n" + " Collared Floating Leg NPV: " + npvCollaredLeg + "\n" + " Floating Leg NPV - Collar NPV: " + (npvVanilla - npvCollar) + "\n" + @@ -347,7 +347,7 @@ public void testDecomposition() error = Math.Abs(npvCappedLeg - (npvVanilla-npvCap)); if (error>tolerance) { - Assert.Fail("\nCapped Leg: gearing=" + gearing_p + ", " + + QAssert.Fail("\nCapped Leg: gearing=" + gearing_p + ", " + "spread= " + spread_p *100 + "%, strike=" + capstrike*100 + "%, " + "effective strike= " + (capstrike-spread_p)/gearing_p*100 + @@ -372,7 +372,7 @@ public void testDecomposition() error = Math.Abs(npvCappedLeg - (npvVanilla+ gearing_n*npvFloor)); if (error>tolerance) { - Assert.Fail("\nCapped Leg: gearing=" + gearing_n + ", " + + QAssert.Fail("\nCapped Leg: gearing=" + gearing_n + ", " + "spread= " + spread_n *100 + "%, strike=" + capstrike*100 + "%, " + "effective strike= " + (capstrike-spread_n)/gearing_n*100 + @@ -410,7 +410,7 @@ public void testDecomposition() error = Math.Abs(npvFlooredLeg - (npvVanilla+npvFloor)); if (error>tolerance) { - Assert.Fail("\nFloored Leg: gearing=" + gearing_p + ", " + QAssert.Fail("\nFloored Leg: gearing=" + gearing_p + ", " + "spread= " + spread_p *100+ "%, strike=" + floorstrike *100 + "%, " + "effective strike= " + (floorstrike-spread_p)/gearing_p*100 + "%\n" + @@ -433,7 +433,7 @@ public void testDecomposition() error = Math.Abs(npvFlooredLeg - (npvVanilla - gearing_n*npvCap)); if (error>tolerance) { - Assert.Fail("\nCapped Leg: gearing=" + gearing_n + ", " + + QAssert.Fail("\nCapped Leg: gearing=" + gearing_n + ", " + "spread= " + spread_n *100 + "%, strike=" + floorstrike*100 + "%, " + "effective strike= " + (floorstrike-spread_n)/gearing_n*100 + @@ -464,7 +464,7 @@ public void testDecomposition() error = Math.Abs(npvCollaredLeg - (npvVanilla - npvCollar)); if (error>tolerance) { - Assert.Fail("\nCollared Leg: gearing=" + gearing_p + ", " + QAssert.Fail("\nCollared Leg: gearing=" + gearing_p + ", " + "spread= " + spread_p*100 + "%, strike=" + floorstrike*100 + "% and " + capstrike*100 + "%, " @@ -491,7 +491,7 @@ public void testDecomposition() error = Math.Abs(npvCollaredLeg - (npvVanilla - gearing_n*npvCollar)); if (error>tolerance) { - Assert.Fail("\nCollared Leg: gearing=" + gearing_n + ", " + QAssert.Fail("\nCollared Leg: gearing=" + gearing_n + ", " + "spread= " + spread_n*100 + "%, strike=" + floorstrike*100 + "% and " + capstrike*100 + "%, " diff --git a/Test/T_CliquetOption.cs b/Test/T_CliquetOption.cs index 577555c50..99d32e9e8 100644 --- a/Test/T_CliquetOption.cs +++ b/Test/T_CliquetOption.cs @@ -101,7 +101,7 @@ public void testValues() double tolerance = 1e-4; if (error > tolerance) { - Assert.Fail("value", payoff, exercise, spot.value(), + REPORT_FAILURE("value", payoff, exercise, spot.value(), qRate.value(), rRate.value(), today, vol.value(), expected, calculated, error, tolerance); diff --git a/Test/T_Cms.cs b/Test/T_Cms.cs index 52927c479..b3811f49f 100644 --- a/Test/T_Cms.cs +++ b/Test/T_Cms.cs @@ -295,7 +295,7 @@ public void testFairRate() bool linearTsr = j==vars.yieldCurveModels.Count-1; if (difference > tol) - Assert.Fail("\nCoupon payment date: " + paymentDate + + QAssert.Fail("\nCoupon payment date: " + paymentDate + "\nCoupon start date: " + startDate + "\nCoupon floor: " + (infiniteFloor) + "\nCoupon gearing: " + (gearing) + @@ -363,8 +363,8 @@ public void testCmsSwap() double difference = Math.Abs(priceNum-priceAn); double tol = 2.0e-4; bool linearTsr = j==vars.yieldCurveModels.Count-1; - if (difference > tol) - Assert.Fail("\nLength in Years: " + swapLengths[sl] + + if (difference > tol) + QAssert.Fail("\nLength in Years: " + swapLengths[sl] + "\nswap index: " + swapIndex.name() + "\nibor index: " + vars.iborIndex.name() + "\nspread: " + (spread) + @@ -440,7 +440,7 @@ public void testParity() if(linearTsr) tol = 1.0e-7; if (difference > tol) - Assert.Fail("\nCoupon payment date: " + paymentDate + + QAssert.Fail("\nCoupon payment date: " + paymentDate + "\nCoupon start date: " + startDate + "\nCoupon gearing: " + (gearing) + "\nCoupon swap index: " + swapIndex.name() + diff --git a/Test/T_DigitalCoupon.cs b/Test/T_DigitalCoupon.cs index 95d508324..0ca5887f9 100644 --- a/Test/T_DigitalCoupon.cs +++ b/Test/T_DigitalCoupon.cs @@ -139,7 +139,7 @@ public void testAssetOrNothing() vars.nominal * accrualPeriod * discount; double error = Math.Abs(nd1Price - optionPrice); if (error>vars.optionTolerance) - Assert.Fail("\nDigital Call Option:" + + QAssert.Fail("\nDigital Call Option:" + "\nVolatility = " + (capletVol) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -172,7 +172,7 @@ public void testAssetOrNothing() * forward / effFwd; error = Math.Abs(nd1Price - callVO); if (error>vars.blackTolerance) - Assert.Fail("\nDigital Call Option:" + + QAssert.Fail("\nDigital Call Option:" + "\nVolatility = " + (capletVol) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -195,7 +195,7 @@ public void testAssetOrNothing() vars.nominal * accrualPeriod * discount; error = Math.Abs(nd1Price - optionPrice); if (error>vars.optionTolerance) - Assert.Fail("\nDigital Put Option:" + + QAssert.Fail("\nDigital Put Option:" + "\nVolatility = " + (capletVol) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -228,7 +228,7 @@ public void testAssetOrNothing() * forward / effFwd; error = Math.Abs(nd1Price - putVO); if (error>vars.blackTolerance) - Assert.Fail("\nDigital Put Option:" + + QAssert.Fail("\nDigital Put Option:" + "\nVolatility = " + (capletVol) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -290,7 +290,7 @@ public void testAssetOrNothingDeepInTheMoney() double error = Math.Abs(targetPrice - digitalPrice); double tolerance = 1e-08; if (error>tolerance) - Assert.Fail("\nFloating Coupon - Digital Call Option:" + + QAssert.Fail("\nFloating Coupon - Digital Call Option:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -304,7 +304,7 @@ public void testAssetOrNothingDeepInTheMoney() error = Math.Abs(targetOptionPrice - replicationOptionPrice); double optionTolerance = 1e-08; if (error>optionTolerance) - Assert.Fail("\nDigital Call Option:" + + QAssert.Fail("\nDigital Call Option:" + "\nVolatility = " + +(capletVolatility) + "\nStrike = " + +(strike) + "\nExercise = " + k+1 + " years" + @@ -325,7 +325,7 @@ public void testAssetOrNothingDeepInTheMoney() error = Math.Abs(targetPrice - digitalPrice); tolerance = 2.5e-06; if (error>tolerance) - Assert.Fail("\nFloating Coupon + Digital Put Option:" + + QAssert.Fail("\nFloating Coupon + Digital Put Option:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -339,7 +339,7 @@ public void testAssetOrNothingDeepInTheMoney() error = Math.Abs(targetOptionPrice - replicationOptionPrice); optionTolerance = 2.5e-06; if (error>optionTolerance) - Assert.Fail("\nDigital Put Option:" + + QAssert.Fail("\nDigital Put Option:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -396,7 +396,7 @@ public void testAssetOrNothingDeepOutTheMoney() double error = Math.Abs(targetPrice - digitalPrice); double tolerance = 1e-10; if (error>tolerance) - Assert.Fail("\nFloating Coupon - Digital Call Option :" + + QAssert.Fail("\nFloating Coupon - Digital Call Option :" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -411,7 +411,7 @@ public void testAssetOrNothingDeepOutTheMoney() error = Math.Abs(targetOptionPrice - replicationOptionPrice); double optionTolerance = 1e-08; if (error>optionTolerance) - Assert.Fail("\nDigital Call Option:" + + QAssert.Fail("\nDigital Call Option:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -431,7 +431,7 @@ public void testAssetOrNothingDeepOutTheMoney() tolerance = 1e-08; error = Math.Abs(targetPrice - digitalPrice); if (error>tolerance) - Assert.Fail("\nFloating Coupon + Digital Put Coupon:" + + QAssert.Fail("\nFloating Coupon + Digital Put Coupon:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -445,7 +445,7 @@ public void testAssetOrNothingDeepOutTheMoney() vars.nominal * accrualPeriod * discount; error = Math.Abs(targetOptionPrice - replicationOptionPrice); if (error>optionTolerance) - Assert.Fail("\nDigital Put Coupon:" + + QAssert.Fail("\nDigital Put Coupon:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -523,7 +523,7 @@ public void testCashOrNothing() vars.nominal * accrualPeriod * discount; double error = Math.Abs(nd2Price - optionPrice); if (error>vars.optionTolerance) - Assert.Fail("\nDigital Call Option:" + + QAssert.Fail("\nDigital Call Option:" + "\nVolatility = " + (capletVol) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -552,7 +552,7 @@ public void testCashOrNothing() * discount / discountAtFixing; error = Math.Abs(nd2Price - callVO); if (error>vars.blackTolerance) - Assert.Fail("\nDigital Call Option:" + + QAssert.Fail("\nDigital Call Option:" + "\nVolatility = " + (capletVol) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -573,7 +573,7 @@ public void testCashOrNothing() vars.nominal * accrualPeriod * discount; error = Math.Abs(nd2Price - optionPrice); if (error>vars.optionTolerance) - Assert.Fail("\nPut Digital Option:" + + QAssert.Fail("\nPut Digital Option:" + "\nVolatility = " + (capletVol) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -589,7 +589,7 @@ public void testCashOrNothing() * discount / discountAtFixing; error = Math.Abs(nd2Price - putVO); if (error>vars.blackTolerance) - Assert.Fail("\nDigital Put Option:" + + QAssert.Fail("\nDigital Put Option:" + "\nVolatility = " + (capletVol) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -650,7 +650,7 @@ public void testCashOrNothingDeepInTheMoney() double error = Math.Abs(targetPrice - digitalPrice); double tolerance = 1e-07; if (error>tolerance) - Assert.Fail("\nFloating Coupon - Digital Call Coupon:" + + QAssert.Fail("\nFloating Coupon - Digital Call Coupon:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -664,7 +664,7 @@ public void testCashOrNothingDeepInTheMoney() error = Math.Abs(targetOptionPrice - replicationOptionPrice); double optionTolerance = 1e-07; if (error>optionTolerance) - Assert.Fail("\nDigital Call Option:" + + QAssert.Fail("\nDigital Call Option:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -683,7 +683,7 @@ public void testCashOrNothingDeepInTheMoney() digitalPrice = digitalFlooredCoupon.price(vars.termStructure); error = Math.Abs(targetPrice - digitalPrice); if (error>tolerance) - Assert.Fail("\nFloating Coupon + Digital Put Option:" + + QAssert.Fail("\nFloating Coupon + Digital Put Option:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -696,7 +696,7 @@ public void testCashOrNothingDeepInTheMoney() vars.nominal * accrualPeriod * discount; error = Math.Abs(targetOptionPrice - replicationOptionPrice); if (error>optionTolerance) - Assert.Fail("\nDigital Put Coupon:" + + QAssert.Fail("\nDigital Put Coupon:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + +(strike) + "\nExercise = " + k+1 + " years" + @@ -754,7 +754,7 @@ public void testCashOrNothingDeepOutTheMoney() double error = Math.Abs(targetPrice - digitalPrice); double tolerance = 1e-10; if (error>tolerance) - Assert.Fail("\nFloating Coupon + Digital Call Option:" + + QAssert.Fail("\nFloating Coupon + Digital Call Option:" + "\nVolatility = " + +(capletVolatility) + "\nStrike = " + +(strike) + "\nExercise = " + k+1 + " years" + @@ -769,7 +769,7 @@ public void testCashOrNothingDeepOutTheMoney() error = Math.Abs(targetOptionPrice - replicationOptionPrice); double optionTolerance = 1e-10; if (error>optionTolerance) - Assert.Fail("\nDigital Call Option:" + + QAssert.Fail("\nDigital Call Option:" + "\nVolatility = " + +(capletVolatility) + "\nStrike = " + +(strike) + "\nExercise = " + k+1 + " years" + @@ -789,7 +789,7 @@ public void testCashOrNothingDeepOutTheMoney() tolerance = 1e-09; error = Math.Abs(targetPrice - digitalPrice); if (error>tolerance) - Assert.Fail("\nDigital Floored Coupon:" + + QAssert.Fail("\nDigital Floored Coupon:" + "\nVolatility = " + +(capletVolatility) + "\nStrike = " + +(strike) + "\nExercise = " + k+1 + " years" + @@ -803,7 +803,7 @@ public void testCashOrNothingDeepOutTheMoney() vars.nominal * accrualPeriod * discount; error = Math.Abs(targetOptionPrice - replicationOptionPrice); if (error>optionTolerance) - Assert.Fail("\nDigital Put Option:" + + QAssert.Fail("\nDigital Put Option:" + "\nVolatility = " + +(capletVolatility) + "\nStrike = " + +(strike) + "\nExercise = " + k+1 + " years" + @@ -873,7 +873,7 @@ public void testCallPutParity() double error = Math.Abs(targetPrice - digitalPrice); double tolerance = 1.0e-08; if (error>tolerance) - Assert.Fail("\nCash-or-nothing:" + + QAssert.Fail("\nCash-or-nothing:" + "\nVolatility = " + +(capletVolatility) + "\nStrike = " + +(strike) + "\nExercise = " + k+1 + " years" + @@ -897,7 +897,7 @@ public void testCallPutParity() error = Math.Abs(targetPrice - digitalPrice); tolerance = 1.0e-07; if (error>tolerance) - Assert.Fail("\nAsset-or-nothing:" + + QAssert.Fail("\nAsset-or-nothing:" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -972,7 +972,7 @@ public void testReplicationType() ( (central_digitalPrice>over_digitalPrice) && Math.Abs(central_digitalPrice - over_digitalPrice)>tolerance ) ) { - Assert.Fail("\nCash-or-nothing: Floating Rate Coupon + Call Digital option" + + QAssert.Fail("\nCash-or-nothing: Floating Rate Coupon + Call Digital option" + "\nVolatility = " + +(capletVolatility) + "\nStrike = " + +(strike) + "\nExercise = " + k+1 + " years" + @@ -1001,7 +1001,7 @@ public void testReplicationType() ( (central_digitalPrice>over_digitalPrice) && Math.Abs(central_digitalPrice - over_digitalPrice)>tolerance ) ) { - Assert.Fail("\nCash-or-nothing: Floating Rate Coupon - Call Digital option" + + QAssert.Fail("\nCash-or-nothing: Floating Rate Coupon - Call Digital option" + "\nVolatility = " + +(capletVolatility) + "\nStrike = " + +(strike) + "\nExercise = " + k+1 + " years" + @@ -1027,7 +1027,7 @@ public void testReplicationType() ( (central_digitalPrice>over_digitalPrice) && Math.Abs(central_digitalPrice - over_digitalPrice)>tolerance ) ) { - Assert.Fail("\nCash-or-nothing: Floating Rate Coupon + Put Digital option" + + QAssert.Fail("\nCash-or-nothing: Floating Rate Coupon + Put Digital option" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + @@ -1054,7 +1054,7 @@ public void testReplicationType() ( (central_digitalPrice>over_digitalPrice) && Math.Abs(central_digitalPrice - over_digitalPrice)>tolerance ) ) { - Assert.Fail("\nCash-or-nothing: Floating Rate Coupon + Call Digital option" + + QAssert.Fail("\nCash-or-nothing: Floating Rate Coupon + Call Digital option" + "\nVolatility = " + (capletVolatility) + "\nStrike = " + (strike) + "\nExercise = " + k+1 + " years" + diff --git a/Test/T_InflationCPICapFloor.cs b/Test/T_InflationCPICapFloor.cs index 7943be26e..b21b406a3 100644 --- a/Test/T_InflationCPICapFloor.cs +++ b/Test/T_InflationCPICapFloor.cs @@ -365,7 +365,7 @@ public void cpicapfloorpricesurface() double a = common.cPriceUK[i,j]; double b = cpiSurf.capPrice(t,qK); - Assert.IsTrue(Math.Abs(a-b)<1e-7,"cannot reproduce cpi cap data from surface: " + QAssert.IsTrue(Math.Abs(a-b)<1e-7,"cannot reproduce cpi cap data from surface: " + a + " vs constructed = " + b); } } @@ -434,7 +434,7 @@ public void cpicapfloorpricer() double cached = cpiCFsurfUKh.link.capPrice(d, strike); - Assert.IsTrue(Math.Abs(cached - aCap.NPV())<1e-10,"InterpolatingCPICapFloorEngine does not reproduce cached price: " + QAssert.IsTrue(Math.Abs(cached - aCap.NPV())<1e-10,"InterpolatingCPICapFloorEngine does not reproduce cached price: " + cached + " vs " + aCap.NPV()); // remove circular refernce diff --git a/Test/T_Matrices.cs b/Test/T_Matrices.cs index 83c3da4d4..0937d63d7 100644 --- a/Test/T_Matrices.cs +++ b/Test/T_Matrices.cs @@ -379,11 +379,11 @@ public void testInverse() for (int i=0; i < A.rows(); ++i) eins[i,i] = 1.0; if (norm(I1 - eins) > tol) - Assert.Fail("inverse(A)*A does not recover unit matrix (norm = " + QAssert.Fail("inverse(A)*A does not recover unit matrix (norm = " + norm(I1-eins) + ")"); if (norm(I2 - eins) > tol) - Assert.Fail("A*inverse(A) does not recover unit matrix (norm = " + QAssert.Fail("A*inverse(A) does not recover unit matrix (norm = " + norm(I1-eins) + ")"); } } diff --git a/Test/T_SwaptionVolatilityCube.cs b/Test/T_SwaptionVolatilityCube.cs index b6e4b8548..5f04eab9d 100644 --- a/Test/T_SwaptionVolatilityCube.cs +++ b/Test/T_SwaptionVolatilityCube.cs @@ -55,7 +55,7 @@ public void makeAtmVolTest( SwaptionVolatilityCube volCube, double tolerance ) double actVol = volCube.volatility(atm.tenors.options[i], atm.tenors.swaps[j], strike, true); double error = Math.Abs(expVol-actVol); if (error>tolerance) - Assert.Fail("recovery of atm vols failed:" + + QAssert.Fail("recovery of atm vols failed:" + "\nexpiry time = " + atm.tenors.options[i] + "\nswap length = " + atm.tenors.swaps[j] + "\n atm strike = " + strike + @@ -83,7 +83,7 @@ public void makeVolSpreadsTest(SwaptionVolatilityCube volCube,double tolerance) double expVolSpread = cube.volSpreads[i*cube.tenors.swaps.Count+j,k]; double error = Math.Abs(expVolSpread-spread); if (error>tolerance) - Assert.Fail("\nrecovery of smile vol spreads failed:" + + QAssert.Fail("\nrecovery of smile vol spreads failed:" + "\n option tenor = " + cube.tenors.options[i] + "\n swap tenor = " + cube.tenors.swaps[j] + "\n atm strike = " + atmStrike + @@ -258,7 +258,7 @@ public void testSpreadedCube() double diff = spreadedVolCube.volatility(vars.cube.tenors.options[i], vars.cube.tenors.swaps[j], strike) - volCube.link.volatility(vars.cube.tenors.options[i], vars.cube.tenors.swaps[j], strike); if (Math.Abs(diff-spread.value())>1e-16) - Assert.Fail("\ndiff!=spread in volatility method:" + + QAssert.Fail("\ndiff!=spread in volatility method:" + "\nexpiry time = " + vars.cube.tenors.options[i] + "\nswap length = " + vars.cube.tenors.swaps[j] + "\n atm strike = " + (strike) + @@ -267,7 +267,7 @@ public void testSpreadedCube() diff = smileSectionBySpreadedCube.volatility(strike) - smileSectionByCube.volatility(strike); if (Math.Abs(diff-spread.value())>1e-16) - Assert.Fail("\ndiff!=spread in smile section method:" + + QAssert.Fail("\ndiff!=spread in smile section method:" + "\nexpiry time = " + vars.cube.tenors.options[i] + "\nswap length = " + vars.cube.tenors.swaps[j] + "\n atm strike = " + (strike) + @@ -282,12 +282,12 @@ public void testSpreadedCube() spreadedVolCube.registerWith(f.update); volCube.link.update(); if(!f.isUp()) - Assert.Fail("SpreadedSwaptionVolatilityStructure does not propagate notifications"); + QAssert.Fail("SpreadedSwaptionVolatilityStructure does not propagate notifications"); f.lower(); spread.setValue(.001); if(!f.isUp()) - Assert.Fail("SpreadedSwaptionVolatilityStructure does not propagate notifications"); + QAssert.Fail("SpreadedSwaptionVolatilityStructure does not propagate notifications"); } #if QL_DOTNET_FRAMEWORK @@ -357,8 +357,8 @@ public void testObservability() vars.cube.tenors.swaps[j], dummyStrike + vars.cube.strikeSpreads[k], false); - if (Math.Abs(v0 - v1) > 1e-14) - Assert.Fail(" option tenor = " + vars.cube.tenors.options[i] + + if (Math.Abs(v0 - v1) > 1e-14) + QAssert.Fail(" option tenor = " + vars.cube.tenors.options[i] + " swap tenor = " + vars.cube.tenors.swaps[j] + " strike = " + (dummyStrike+vars.cube.strikeSpreads[k])+ " v0 = " + (v0) + @@ -408,7 +408,7 @@ public void testObservability() dummyStrike + vars.cube.strikeSpreads[k], false); if (Math.Abs(v0 - v1) > 1e-14) - Assert.Fail(" option tenor = " + vars.cube.tenors.options[i] + + QAssert.Fail(" option tenor = " + vars.cube.tenors.options[i] + " swap tenor = " + vars.cube.tenors.swaps[j] + " strike = " + (dummyStrike+vars.cube.strikeSpreads[k])+ " v0 = " + (v0) + diff --git a/Test/T_TermStructures.cs b/Test/T_TermStructures.cs index fe1e8a652..7a77b5aae 100644 --- a/Test/T_TermStructures.cs +++ b/Test/T_TermStructures.cs @@ -390,9 +390,9 @@ public void testInterpolatedZeroCurveWithRefDateAndTenorDates() for ( int i = 0; i < tenors.Length; i++ ) { var test = curve.interpolation_.value( tenors[i],true ); - Assert.AreEqual( yields[i], test ); + QAssert.AreEqual( yields[i], test ); } - Assert.AreNotEqual( yields[0], curve.interpolation_.value( 0.0,true ) ); + QAssert.AreNotEqual( yields[0], curve.interpolation_.value( 0.0,true ) ); } } } diff --git a/Test/Test.csproj b/Test/Test.csproj index 74ff7ed2c..76da5308a 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -38,7 +38,7 @@ true full false - bin\Debug\ + bin\Debug\net40\ TRACE;DEBUG;QL_DOTNET_FRAMEWORK prompt 4 @@ -48,13 +48,33 @@ pdbonly true - bin\Release\ + bin\Release\net40\ TRACE;QL_DOTNET_FRAMEWORK prompt 4 AllRules.ruleset false + + true + bin\Debug\net45\ + TRACE;DEBUG;QL_DOTNET_FRAMEWORK + full + v4.5 + AnyCPU + prompt + AllRules.ruleset + + + bin\Release\net45\ + TRACE;QL_DOTNET_FRAMEWORK + true + pdbonly + v4.5 + AnyCPU + prompt + AllRules.ruleset + @@ -172,11 +192,11 @@ - \ No newline at end of file diff --git a/Test/Utilities.cs b/Test/Utilities.cs index 698de93a5..5cca58a0d 100644 --- a/Test/Utilities.cs +++ b/Test/Utilities.cs @@ -207,6 +207,16 @@ public static void AreEqual( T expected, T actual, string message ) #endif } + public static void AreNotEqual(T expected, T actual) + { + + #if QL_DOTNET_FRAMEWORK + Assert.AreNotEqual( expected, actual ); + #else + Assert.NotEqual(expected, actual); + #endif + } + public static void IsTrue( bool condition, string message ) { #if QL_DOTNET_FRAMEWORK